asp.net identity - Email cannot be null or empty while creating new user? -


i using identityserver 3 authentication. storing users in sql db using asp.net identity framework. indentityserver team has provided simple identitymanager.aspnetidentity library administrators manage users.

i followed video here , configured application.

i have own applicationuser , applicationusermanager class below

public class applicationuser : microsoft.aspnet.identity.entityframework.identityuser { }  public class applicationusermanager : microsoft.aspnet.identity.usermanager<applicationuser, string> {     public applicationusermanager(applicationuserstore store, idataprotectionprovider dataprotectionprovider)         : base(store)     {         // configure validation logic usernames         uservalidator = new uservalidator<applicationuser>(this)         {             allowonlyalphanumericusernames = false,             requireuniqueemail = true                         };          // configure validation logic passwords         passwordvalidator = new passwordvalidator         {             requiredlength = 6,             requirenonletterordigit = true,             requiredigit = true,             requirelowercase = true,             requireuppercase = true,         };          // configure user lockout defaults         userlockoutenabledbydefault = true;         defaultaccountlockouttimespan = timespan.fromminutes(5);         maxfailedaccessattemptsbeforelockout = 5;          emailservice = new emailservice();         smsservice = new smsservice();          if (dataprotectionprovider != null)         {             usertokenprovider =                 new dataprotectortokenprovider<applicationuser>(dataprotectionprovider.create("usertoken"));         }     }        } 

when try create user, error

email cannot null or empty.

enter image description here

i can rid of error setting requireuniqueemail false in applicationusermanager. not requirement. want keep requireuniqueemail true

question
how email address field appear on create new user page. note applicationuser derived identityuser has email property. not sure why not appearing on create new user page?

update 1
looked @ code new user in github, developed in angular. i'm not familiar angular syntax :( , how model passed view. not sure need in consumer application enable email field on new user screen.

i partially solved problem

the create user page shows required property of indetityuser ( in case applicationuser derived identityuser). email property in identityuser class virtual. can override property in applicationuser , add required attribute

public class applicationuser : identityuser {     [required]     public override string email { get; set; } } 

this add email field on create user page want. when edit user shows email field twice. ( me okay time being since functionality internal only)


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -