解决方法
您应该重写IdentityErrorDescriber的方法以更改标识错误消息.
public class YourIdentityErrorDescriber : IdentityErrorDescriber { public override IdentityError PasswordRequiresUpper() { return new IdentityError { Code = nameof(PasswordRequiresUpper),Description = "<your error message>" }; } //... other methods }
在Startup.cs中设置IdentityErrorDescriber
public void ConfigureServices(IServiceCollection services) { // ... services.AddIdentity<ApplicationUser,IdentityRole>() .AddErrorDescriber<YourIdentityErrorDescriber>(); }