Esempio n. 1
0
        public UserEntity Authenticate(string email, string password)
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
            {
                return(null);
            }

            var user = _userEntityRepository.GetAll().SingleOrDefault(x => x.Email == email);

            // check if username exists
            if (user == null)
            {
                return(null);
            }

            // check if password is correct
            if (!PasswordHelper.Verify(password, user.Password))
            {
                return(null);
            }

            // authentication successful
            return(user);
        }
Esempio n. 2
0
 public IEnumerable <User> GetAll()
 {
     return(_userRepository.GetAll());
 }