Add Application User with UserName different then eMail

Hello,

is it possible to add a new Application User with UserName different then eMail?

if I add the UserName Field to the form it doesn't work - it seems that the eMail is added to the UserName Property:
image

robert

Hi @Mad.Rain,

You can change the code which creates the new user. It is in ApplicationUsersController.cs (the Post method).

var user = new ApplicationUser { UserName = email, Email = email, EmailConfirmed = true };

Thank you - it works

        var email = data.Email;
        var username = data.Name;
        var password = data.Password;

        var user = new ApplicationUser { UserName = username, Email = email, EmailConfirmed = true };

Happy to hear that. Test if the login works for new users. You may have to make changes to the LoginController as well.