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