I am working with the new ASP.NET Identity (RTM) and I was wondering how would I go on about changing registering and login from being a UserName to an Email.
The id
I get this working.
First go to accountViewModels and add a Property for the UserName
Public Class RegisterViewModel
Public Property UserName As String
Public Property Email As String
After modify your Register view adding the username property
@Html.LabelFor(Function(m) m.UserName, New With {.class = "col-md-2 control-label"})
@Html.TextBoxFor(Function(m) m.UserName, New With {.class = "form-control"})
@Html.LabelFor(Function(m) m.Email, New With {.class = "col-md-2 control-label"})
@Html.TextBoxFor(Function(m) m.Email, New With {.class = "form-control"})
Once this is done, modify too your Login view
@Html.ValidationSummary(True, "", New With {.class = "text-danger"})
@Html.Label("User Name", New With {.class = "col-md-2 control-label"})
@Html.TextBoxFor(Function(m) m.Email, New With {.class = "form-control"})
@Html.ValidationMessageFor(Function(m) m.Email, "", New With {.class = "text-danger"})
@Html.LabelFor(Function(m) m.Password, New With {.class = "col-md-2 control-label"})
@Html.PasswordFor(Function(m) m.Password, New With {.class = "form-control"})
@Html.ValidationMessageFor(Function(m) m.Password, "", New With {.class = "text-danger"})
That is all you need. This way you can LogIn with the UserName not with the email address.