Skip to content

BROKEN? ASP.Net Core Identity User login being based on NormalizedUserName DB field and not NormalizedEmail #7995

@EdwardL75

Description

@EdwardL75

Recently I noticed with my WebAPI I am creating based on generic template for 'Individual Account' setup, that upon trying to re-log a registered user back in even though the login page/view requestes the user's email, it is actually taking that INPUT and comparing against NormalizedUserName in the DB. This I verified by changing the UserName fields in the DB and commenting out the [EmailAddress] datatype requirement for email in the LoginViewModel.cs file.

My question: 1) is this something that was recently broken or always been there? 2) How can I correct this to verify against the NormalizedEmail value?

The point of this is that I offer a user the ability to input a UserName upon registering. This is done by adding the property in the RegisterViewModel.cs, label/input in the Register.cshtml and in the controller changing the line (#108) inside the async Task<IActionResult> Register

var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
to
var user = new ApplicationUser { UserName = model.UserName, Email = model.Email };

This is what is installed

Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3
Microsoft .NET Framework Version 4.6.01586
ASP.NET and Web Tools 2015.1
ASP.NET Web Frameworks and Tools 2012.2
ASP.NET Web Frameworks and Tools 2013
Microsoft .NET Core Tools (Preview 2)
NuGet Package Manager 3.5.0
SQL Server Data Tools 14.0.60519.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions