public void Insert(UserModel userModel) { userModel.Password = EncrypUtil.MD5Encry(userModel.Password); var command = new CreateUserCommand(TransferModel(userModel)); _eventBus.Publish(command); }
public void UpdatePassword(string account, string password, string oldPassword) { UserModel userModel = new UserModel(); userModel.Password = password; userModel.Account = account; var command = new UpdateUserCommand(TransferModel(userModel), EncrypUtil.MD5Encry(oldPassword)); _eventBus.Publish(command); }
public UserDTO Login(string account, string password) { User user = _userRepository.SelectSingle(s => s.Account == account); if (user == null) { throw new AuthException("用户名不存在或密码错误"); } if (user.Password != EncrypUtil.MD5Encry(password)) { throw new AuthException("用户名不存在或密码错误"); } return(ConvertToDto(user)); }
public User SelectUser(string Account, string password) { User user = _userRepository.SelectUserByAccount(Account); if (user == null) { throw new ValidationException("用户名不存在或密码错误"); } if (user.Password != EncrypUtil.MD5Encry(password)) { throw new ValidationException("用户名不存在或密码错误"); } return(user); }