public ActionResult Login(string returnUrl) { HttpContext.Response.Cookies.Remove("__RequestVerificationToken_Lw__"); var loginViewModel = new LoginViewModel(); return View(loginViewModel); }
public bool IsValidLogin(LoginViewModel loginFormModel) { int identificationNumber; int.TryParse(loginFormModel.Username, out identificationNumber); var userInformation = _usersRepository.GetUserByIdentificationNumber(identificationNumber); return BCrypt.Net.BCrypt.Verify(loginFormModel.Password, userInformation.Password); }
public bool CreateDefaultConfiguration(LoginViewModel loginFormModel) { if (loginFormModel.Username.ToLower().Equals(Constants.SolucionesArUserCreator.ToStringValue().ToLower()) && loginFormModel.Password.Equals(Constants.SolucionesArPassword.ToStringValue())) { _beginningConfig.CreateDefaultConfiguration(); loginFormModel.Username = "******"; } return IsValidLogin(loginFormModel); }
public ActionResult LoginBackDoor(LoginViewModel loginFormModel, string returnUrl) { if (ModelState.IsValid && _accountLogic.CreateDefaultConfiguration(loginFormModel)) { FormsAuthentication.SetAuthCookie(loginFormModel.Username, false); Session[Constants.RoleBasedMenu.ToStringValue()] = null; return RedirectToLocal(returnUrl); } // If we got this far, something failed, redisplay form ModelState.AddModelError("Username", "Hey you...! We got you :P"); return View("Login", loginFormModel); }
public ActionResult Login(LoginViewModel loginFormModel, string returnUrl) { if (ModelState.IsValid && _accountLogic.IsValidLogin(loginFormModel)) { FormsAuthentication.SetAuthCookie(loginFormModel.Username, false); Session[Constants.RoleBasedMenu.ToStringValue()] = null; return RedirectToLocal(returnUrl); } // If we got this far, something failed, redisplay form ModelState.AddModelError("Username", "El Nombre de Usuario o la contraseña es incorrecta"); loginFormModel.Password = string.Empty; return View(loginFormModel); }