public virtual async Task <IdentityResult> ChangePasswordAsync(TUser user, string newPassword)
        {
            var result = await PasswordValidator.ValidateAsync(newPassword);

            if (!result.Succeeded)
            {
                return(result);
            }

            await CodeZeroStore.SetPasswordHashAsync(user, PasswordHasher.HashPassword(newPassword));

            return(IdentityResult.Success);
        }
Exemplo n.º 2
0
        public virtual async Task <IdentityResult> ChangePasswordAsync(TUser user, string newPassword)
        {
            var errors = new List <IdentityError>();

            foreach (var validator in PasswordValidators)
            {
                var validationResult = await validator.ValidateAsync(this, user, newPassword);

                if (!validationResult.Succeeded)
                {
                    errors.AddRange(validationResult.Errors);
                }
            }

            if (errors.Any())
            {
                return(IdentityResult.Failed(errors.ToArray()));
            }

            await CodeZeroStore.SetPasswordHashAsync(user, PasswordHasher.HashPassword(user, newPassword));

            return(IdentityResult.Success);
        }
 private Task <TRole> FindByDisplayNameAsync(string displayName)
 {
     return(CodeZeroStore.FindByDisplayNameAsync(displayName));
 }
Exemplo n.º 4
0
 protected virtual Task <string> GetOldUserNameAsync(long userId)
 {
     return(CodeZeroStore.GetUserNameFromDatabaseAsync(userId));
 }
Exemplo n.º 5
0
 public virtual Task <TUser> FindByNameOrEmailAsync(int?tenantId, string userNameOrEmailAddress)
 {
     return(CodeZeroStore.FindByNameOrEmailAsync(tenantId, userNameOrEmailAddress));
 }
Exemplo n.º 6
0
 public virtual Task <TUser> FindAsync(int?tenantId, UserLoginInfo login)
 {
     return(CodeZeroStore.FindAsync(tenantId, login));
 }
Exemplo n.º 7
0
 public virtual Task <List <TUser> > FindAllAsync(UserLoginInfo login)
 {
     return(CodeZeroStore.FindAllAsync(login));
 }
Exemplo n.º 8
0
 public virtual Task <TUser> FindByNameOrEmailAsync(string userNameOrEmailAddress)
 {
     return(CodeZeroStore.FindByNameOrEmailAsync(userNameOrEmailAddress));
 }