コード例 #1
0
        public (bool, AppUser) ValidateUserCredentials(string username, string password)
        {
            var u = GetByColumName("Username", username);

            if (!(u.Count > 0))
            {
                return(false, default(AppUser));
            }
            var b = new HashCreate().Verify(password, u.FirstOrDefault().Password);

            return(b, b ? u.FirstOrDefault() : null);
        }
コード例 #2
0
 public (AppUsers, string) CheckUser(string email, string password)
 {
     var(user, b) = GetByColumNameFist("Email", email);
     if (!b)
     {
         return(null, "Error");
     }
     if (user == null)
     {
         return(null, "User Not Found");
     }
     b = new HashCreate().VerfiyPassword(password, user.Password);
     if (!b)
     {
         return(null, "Password incorrect");
     }
     return(user, "Success");
 }