Exemplo n.º 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");
         }
     }
 }
Exemplo n.º 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");
     }
 }
Exemplo n.º 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");
            }
        }