public ActionResult Login(LoginViewModel details, string returnUrl) { if (ModelState.IsValid) { Usuario user = InternoUserManager.Find(details.Nome, details.Senha); if (user == null) { ModelState.AddModelError("", "Nome ou senha inválido(s)."); } else { ClaimsIdentity identidade = InternoUserManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie); InternoAuthManager.SignOut(); InternoAuthManager.SignIn(new AuthenticationProperties { IsPersistent = false }, identidade); if (returnUrl == null) { returnUrl = "/Home"; } return(Redirect(returnUrl)); } } return(View(details)); }
public ActionResult Logout() { InternoAuthManager.SignOut(); return(RedirectToAction("Index", "Home", new { area = "" })); }