I am trying to customize the registration process of Asp.Net Identity(In web-API project). Is it possible to register a new user with PhoneNumber instead of Email with web-API?
Also, the rest of the features of the Identity framework should work with this new approach?
Which challenges would a programmer face with this approach?
Tried changing Email to PhoneNumber in RegisterBindingModel.cs as:
[Required]
[Display(Name = "Mobile number")]
public string PhoneNumber { get; set; }
The original code was:
[Required]
[Display(Name = "Email")]
public string Email{ get; set; }
Changes Made in AccountController.cs
var user = new ApplicationUser() { UserName = model.PhoneNumber, PhoneNumber = model.PhoneNumber };
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
The expected result is A new user register with just PhoneNumber.
The actual result is, Error - "Email cannot be null or empty" which is coming from ModelState.