예제 #1
0
 public ActionResult Login(LoginModel mod)
 {
     if (ModelState.IsValid)
     {
         if (VerifyLogin(mod))
         {
             FormsAuthentication.SetAuthCookie(mod.Username, true);
             return RedirectToAction("Index", "Dash");
         }
         ModelState.AddModelError("", "Invalid username or password.");
     }
     return View();
 }
예제 #2
0
 bool VerifyLogin(LoginModel mod)
 {
     try
     {
         var doc = Databasing.RetrieveById(mod.Username);
         /*Response.Write(doc.passhash);
         Response.Write("   $$$$$$$$$$$<br />");
         Response.Write(mod.PWHash(mod.Password));
         Response.Write("<br />");
         Response.Write(mod.Password);
         Response.Write("<br />");
         Response.Write(mod.PWHash("vadsfGFSDc423fSdg"));*/
         return (doc.passhash == mod.PWHash(mod.Password));
     }
     catch (Exception e)
     {
         Response.Write(e.ToString());
     }
     return false;
 }