How can I config Identity with "ApplicationUserManager" and customize "UserValidator" and "PasswordValidator" and ...?
6 Answer(s)
-
0
In module-zero startup template, you have UserManager class (<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/blob/master/src/AbpCompanyName.AbpProjectName.Core/Users/UserManager.cs">https://github.com/aspnetboilerplate/mo ... Manager.cs</a>). You can override it's methods to change behaviour.
-
0
You are right , but "UserValidator" is not in override methods,
How can I override it?
-
0
Can You help me to override "UserValidator" ?
-
0
I wrote PasswordValidator like this
PasswordValidator = new PasswordValidator() { RequiredLength = 6, RequireNonLetterOrDigit = false, RequireDigit = false, RequireLowercase = false, RequireUppercase = false };
but I Can't create UserValidator because of its arguments
UserValidator = new UserValidator<ApplicationUser>(manager) { AllowOnlyAlphanumericUserNames = false, RequireUniqueEmail = false };
what is "ApplicationUser" and "manager" in Module Zero?
-
0
I made UserValidator Like this
UserValidator = new UserValidator<User, long>(this) { RequireUniqueEmail = false, AllowOnlyAlphanumericUserNames = false };
in the constructor of UserManager, but it still has Error on Emails. I want to Use One Email for All users and Authenticate them only by UserName;
-
0
Hi,
User manager itself checks email adress uniqueness (see <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/master/src/Abp.Zero/Authorization/Users/AbpUserManager.cs#L460">https://github.com/aspnetboilerplate/mo ... er.cs#L460</a>). So, if you user UserManager's CreateAsync method while creating users, their email adress will be unique.
But UserManager.LoginAsync method uses email or user name to login. I think this is better and widely used. If it's really needed, you may override or create your own LoginAsync method.