How to customize ASP.NET Identity Core Username to allow special characters and space

后端 未结 6 1397
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 18:16

I have changed my Register Action Method to accept user Name instead of Email.

if (ModelState.IsValid)
{
    var user = new ApplicationUser          


        
6条回答
  •  伪装坚强ぢ
    2020-12-20 18:43

    You can set user validation rules configuring identity with options in your Startup.cs.

    services.AddIdentity(options => {
        options.User.AllowedUserNameCharacters = "allowed characters here";
        options.User.RequireUniqueEmail = true/false;
    });
    

    Related resources:

    Configure Identity

提交回复
热议问题