public void ChangePassword(string newPassword, IEncryptHelper encryptHelper) { this.Salt = encryptHelper.GenerateSalt(); var encryptedPwd = EncryptPassword(newPassword, this.Salt, encryptHelper); this.Password = encryptedPwd; }
public static UserEntity NewUser(long id, string userName, string password, string realName, IEncryptHelper encryptHelper) { var salt = encryptHelper.GenerateSalt(); var entity = new UserEntity(); entity.Id = id; entity.UserName = userName; entity.Password = EncryptPassword(password, salt, encryptHelper); entity.Salt = salt; entity.RealName = realName; entity.Enable = true; return(entity); }