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);
        }
예제 #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));
 }
예제 #4
0
 protected virtual Task <string> GetOldUserNameAsync(long userId)
 {
     return(CodeZeroStore.GetUserNameFromDatabaseAsync(userId));
 }
예제 #5
0
 public virtual Task <TUser> FindByNameOrEmailAsync(int?tenantId, string userNameOrEmailAddress)
 {
     return(CodeZeroStore.FindByNameOrEmailAsync(tenantId, userNameOrEmailAddress));
 }
예제 #6
0
 public virtual Task <TUser> FindAsync(int?tenantId, UserLoginInfo login)
 {
     return(CodeZeroStore.FindAsync(tenantId, login));
 }
예제 #7
0
 public virtual Task <List <TUser> > FindAllAsync(UserLoginInfo login)
 {
     return(CodeZeroStore.FindAllAsync(login));
 }
예제 #8
0
 public virtual Task <TUser> FindByNameOrEmailAsync(string userNameOrEmailAddress)
 {
     return(CodeZeroStore.FindByNameOrEmailAsync(userNameOrEmailAddress));
 }