Пример #1
0
        public User ValidatePassword(string username, string password)
        {
            var user = _domain.GetUserByPassword(username);

            if (user == null)
            {
                return(null);
            }
            var hashed = SecretHelper.GenerateHashSecret(password);

            if (user.Password == hashed)
            {
                return(user);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
 public void Add(User User)
 {
     User.Id       = Guid.NewGuid();
     User.Password = SecretHelper.GenerateHashSecret(User.Password);
     _domain.Add(User);
 }
Пример #3
0
 public void Update(User User)
 {
     User.Password = SecretHelper.GenerateHashSecret(User.Password);
     _domain.Update(User);
 }
Пример #4
0
 public User GetUserForLogin(string account, string password)
 {
     return(_repository.Query(a => a.UserName == account && SecretHelper.GenerateHashSecret(password) == a.Password).FirstOrDefault());
 }