public void RePassword(int userId, string password) { UserEntity entity = this.userDao.GetEntity(userId); if (entity == null) { throw new UserNullPointerException(); } String code = AESUtil.EncryptHex(password, ApplicationHelp.AES_PASSWORD); entity.Password = code; this.userDao.SaveEntity(entity); }
public UserVO Login(string username, string password) { logger.Info("Login - username="******", password=" + password); UserEntity entity = this.userDao.GetEntityByUsername(username); if (entity == null) { throw new UserNullPointerException(); } else if (!entity.Password.Equals(AESUtil.EncryptHex(password, ApplicationHelp.AES_PASSWORD))) { throw new UserPasswordErrorException(); } else { UserVO vo = new UserVO(); vo.Username = entity.Username; vo.Nickname = entity.Nickname; vo.UserId = entity.UserId; return(vo); } }