title: I need to save the User Name and email address separately. I am am having an issue with logging into the site after the user is registered
body: <p>I am creating a new ASP.NET Core (2.2) WebSite. By default, the UserName and Email Address is the same thing. I want to have them be different. The issue comes in when I try to log that user back into the web page. </p>
  
  <p>I scaffolded the register Identity page and made some simple changes to the Code behind and also the Razor page itself (see below). I did also scaffold the login page, but I don't think that I need to make any changes there, because I am ok with folks logging in using their email address still.</p>
  
  <p>Here are the edits to the Register.cshtml.cs page.</p>
  
  <p>I added this to the InputModel class:</p>
  
  <pre><code>[Required]
  [StringLength(256, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 5)]
  [DataType(DataType.Text)]
  [Display(Name = "User Name")]
  public string UserName { get; set; }
  </code></pre>
  
  <p>I also changed the user in the OnPostAsync method</p>
  
  <pre><code>var user = new IdentityUser { UserName = Input.UserName, Email = Input.Email };
  </code></pre>
  
  <p>Everything else is as default.</p>
  
  <p>On the page itself, I simply added it below the email:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label asp-for="Input.UserName"&gt;&lt;/label&gt;
      &lt;input asp-for="Input.UserName" class="form-control"/&gt;
      &lt;span asp-validation-for="Input.UserName" class="text-danger"&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would expect for the user to be logged in as normal, alas. The error I get is simply "Invalid Log-in attempt". Annoyingly, The user I created before making any changes still is able to be logged in just fine. So my gut tells me that Something is funny in the register page, I am just not sure where.</p>