Ejemplo n.º 1
0
        public void Insert(UserModel userModel)
        {
            userModel.Password = EncrypUtil.MD5Encry(userModel.Password);
            var command = new CreateUserCommand(TransferModel(userModel));

            _eventBus.Publish(command);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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);
        }