Пример #1
0
 public ActionResult CheckLogin(string login, string password) //Check Login and Password for Authenti
 {
     using (MD5 md5Hash = MD5.Create())
     {
         string hash = UserAuthentication.GetMd5Hash(md5Hash, password);     //Get entered password hash
         bool   passwordsSame, loginsSame;
         if (UserAuthentication.VerifyMd5Hash(md5Hash, "25f9e794323b453885f5181f1b624d0b", hash))
         {
             passwordsSame = true;
         }     // The hashes are the same.
         else
         {
             passwordsSame = false;
         }     // The hashes are not same.
         if (UserAuthentication.VerifyLogin(login, "Admin"))
         {
             loginsSame = true;
         }
         else
         {
             loginsSame = false;
         }
         if (UserAuthentication.CheckLoginAndPassword(loginsSame, passwordsSame))
         {
             FormsAuthentication.SetAuthCookie(login, true);
             return(RedirectToAction("Index", "Admin"));
         }
         return(RedirectToAction("Login", "Admin"));
     }
 }