Example #1
0
 public ActionResult Login(string username, string password)
 {
     if (!string.IsNullOrWhiteSpace(password))
     {
         if (_authUtil.Authenticate(username, password))
         {
             //log in user
             FormsAuthentication.SetAuthCookie(username, true);
             Info("Logget inn som " + username);
             var requestUrl = Session["requestUrl"] as string;
             if (!string.IsNullOrEmpty(requestUrl))
             {
                 return(Redirect(requestUrl));
             }
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             Error("Galt brukernavn eller passord");
         }
     }
     else
     {
         Error("Du må skrive inn passord");
     }
     return(View());
 }