Пример #1
0
 public static string LoginAttempt(string username, string password, out UserInfo user)
 {
     using (HREntities db = new HREntities())
     {
         user     = db.UserInfoes.Where(l => l.UserName == username).FirstOrDefault();
         password = PWHashing.Hash(password);
         if (user != null)
         {
             if (String.Compare(password, user.Password) == 0)
             {
                 return("Successfull");
             }
             else
             {
                 user = null;
                 return("Password is Wrong");
             }
         }
         else
         {
             user = null;
             return("Invalid Credentials");
         }
     }
 }
Пример #2
0
 public static string LoginAttempt(string username, string password, out UserInfo user) //Login function
 {
     try
     {
         using (HREntities db = new HREntities())
         {
             user     = db.UserInfoes.Where(l => l.UserName == username).FirstOrDefault();
             password = PWHashing.Hash(password);
             if (user != null)
             {
                 if (String.Compare(password, user.Password) == 0)
                 {
                     return("Successfull");
                 }
                 else
                 {
                     user = null;
                     return("Password is Wrong");
                 }
             }
             else
             {
                 user = null;
                 return("Invalid Credentials");
             }
         }
     }
     catch (Exception ex)
     {
         LogFile.WriteLog(ex);
         user = null;
         return("Exception Caused");
     }
 }
Пример #3
0
        public static string Password(PasswordConfirmation pass)
        {
            pass.password        = PWHashing.Hash(pass.password);
            pass.confirmpassword = PWHashing.Hash(pass.confirmpassword);

            if (pass.password == pass.confirmpassword)
            {
                return("Successfull");
            }
            else
            {
                return("Passswords Don't Match");
            }
        }