示例#1
0
 public bool ChangePassword(Guid userId, PasswordChangeEntity passwordEntity)
 {
     
     User User = context.Users.FirstOrDefault(u => u.Id.Equals(userId));
     if (User == null) return false;
     if (SecurePasswordHasher.Verify(passwordEntity.OldPassword, User.Password))
     {
         //User newPasswordUser = new User(passwordEntity.UserEntity);
         User.Password = SecurePasswordHasher.Hash(passwordEntity.UserEntity.Password);
         context.SaveChanges();
         return true;
     }
     return false;
 }
示例#2
0
 public bool ChangePassword(Guid UserId, [FromBody] PasswordChangeEntity PasswordEntity)
 {
     return(UserService.ChangePassword(UserId, PasswordEntity));
 }