Exemplo n.º 1
0
 public ActionResult LogIn(string ReturnUrl)
 {
     var vm = new Login
     {
         ReturnUrl = ReturnUrl
     };
     return View(vm);
 }
Exemplo n.º 2
0
 public ActionResult LogIn(Login vm)
 {
     if (!ModelState.IsValid)
     {
         return View(vm);
     }
     if (!FormsAuthentication.Authenticate(vm.Username, vm.Password))
     {
         ModelState.AddModelError("", Phrases.ValidationInvalidLogin);
         return View(vm);
     }
     FormsAuthentication.SetAuthCookie(vm.Username, true);
     return !String.IsNullOrWhiteSpace(vm.ReturnUrl) ? (ActionResult)Redirect(vm.ReturnUrl) : (ActionResult)RedirectToAction("index", "home");
 }