示例#1
0
        public async Task <bool> CheckPasswordAsync(User user, string password)
        {
            try
            {
                if (user == null)
                {
                    return(false);
                }
                var userPassword = await _usersData.CheckPasswordAsync(user);

                if (userPassword.Count <= 0)
                {
                    return(false);
                }
                // check a password
                var validPassword = BCrypt.Net.BCrypt.Verify(password, userPassword[0].password);
                return(validPassword);
            }
            catch (Exception e)
            {
                throw e;
            }
        }