public ActionResult LockScreen(string returnUrl) { ViewBag.ReturnUrl = returnUrl; LoginViewModel model = new LoginViewModel(); model.Email = User.Identity.Name; var clubAdmin = _userServices.GetClubByUserName(User.Identity.Name); if (clubAdmin != null) { var club = clubAdmin; model.Logo = _photoManager.FileExistInStorage(FileStorageTypes.Clubs, club.Logo,club.Id) ? "../api/file/Clubs/"+club.Logo+"/"+club.Id : "../Images/Default-logo.png"; model.Background = _photoManager.FileExistInStorage(FileStorageTypes.Clubs, club.Background, club.Id) ? "../api/file/Clubs/" + club.Background + "/" + club.Id : "../Images/Default_background.png"; if (String.IsNullOrWhiteSpace(club.ColorTheme) || String.IsNullOrEmpty(club.ColorTheme)) { model.HexColor = "#3276b1"; } else { model.HexColor = club.ColorTheme; } } else { model.Logo = "../Images/Default-logo.png"; model.Background = "../Images/Default_background.png"; //model.Background model.HexColor = "#3276b1"; } AuthenticationManager.SignOut(); Response.Cookies.Clear(); Session.Clear(); Session.Abandon(); return View(model); }
public async Task<ActionResult> LockScreen(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { ModelState.AddModelError("PassValid", "Please enter password"); return View(model); } // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, change to shouldLockout: true var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false); switch (result) { case SignInStatus.Success: { if (model.Email.ToLower() == "*****@*****.**") { //ViewBag.JSAlert = "toastr.success('Without any options', 'Simple notification!')"; return RedirectToAction("Index", "Home"); } return RedirectToAction("Index", "Home"); } case SignInStatus.LockedOut: return View("Lockout"); case SignInStatus.Failure: default: ModelState.AddModelError("PassValid", "Sorry that password is incorrect, please try again"); return View(model); } }