Reputation: 482
I want to force Identity to only store users with an unique email, otherwise don't allow it to register, and then recover the exception or error when i iterate through the errors of the result of the CreateAsync
method. So How do i do this?
Upvotes: 0
Views: 660
Reputation: 759
The default value for RequireUniqueEmail
is false. You can overwrite it with true to enforce unique email.
services.Configure<IdentityOptions>(options =>
{
//add this option to identity configuration
options.User.RequireUniqueEmail = true;
});
Upvotes: 2