public ActionResult LogOut(LogInModel model) { var autheticationManager = HttpContext.GetOwinContext().Authentication; autheticationManager.SignOut(); return RedirectToAction("Index", "Home"); }
public ActionResult Login(string returnUrl) { var loginModel = new LogInModel() { ReturnUrl = returnUrl }; return View(loginModel); }
public async Task<ActionResult> LogIn(LogInModel model) { if (!ModelState.IsValid) { return View(); } var user = await UserManager.FindByNameOrEmailAsync(model.Login, model.Password); if (user != null) { var roleResult = UserManager.AddToRole(user.Id, "Regular"); await SignInAsync(user, model.RememberMe); return Redirect(GetRedirectUrl(model.ReturnUrl)); } return View(); }