public async Task <ActionResult> LogOut() { await TidalUserManager.LogOutFromTidal(User.Identity); AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); return(RedirectToAction("Index", "Home")); }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { return(View(model)); } var session = await TidalUserManager.LoginToTidal(model.Username, model.Password); if (session == null) { ModelState.AddModelError("", "invalid Tidal username or password"); return(View()); } var userModel = await session.GetUser(); var claimsIdentity = BuildClaimsIdentity(model, session, userModel); AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = model.RememberMe }, claimsIdentity); return(ViewBag.ReturnUrl != null ? Redirect(ViewBag.ReturnUrl) : RedirectToAction("Index", "Home")); }