- Home
- ASP.NET Core
- Identity
- Configure unicity of user's mail addresses using ASP.NET Core Identity
Configure unicity of user's mail addresses using ASP.NET Core Identity
By default, ASP.NET Core Identity doesn't require mail addresses unicity for the users, so several users can have the same mail. To change this behavior, this is very simple. You have just to configure the policy you want in your application's startup class.
public void ConfigureServices(IServiceCollection services)
{
// [...]
// Configure Identity
services.Configure<IdentityOptions>(options =>
{
// User settings
options.User.RequireUniqueEmail = true;
});
// [...]
}
09/10/2016