public virtual ActionResult Login(LogOnModel model) { try { if (!ModelState.IsValid) { ModelState.AddModelError(string.Empty, @"Neteisingai įvestas slaptažodis arba prisijungimo vardas"); } else { var user = userService.ValidateUser(model.UserName, model.Password); if (user != null) { WarehouseManagementAuthentication.AuthenticateUser(user.UserName, user.Id, user.FirstName, false); if (Url.IsLocalUrl(model.ReturnUrl) && model.ReturnUrl.Length > 1 && model.ReturnUrl.StartsWith("/") && !model.ReturnUrl.StartsWith("//") && !model.ReturnUrl.StartsWith("/\\")) { return Redirect(model.ReturnUrl); } return RedirectToAction(MVC.User.List()); } else { ModelState.AddModelError(string.Empty, @"Vartotojas nerastas arba slaptažodis - neteisingas"); } } } catch (Exception exc) { ModelState.AddModelError(string.Empty, "Įvyko klaida, bandykite dar kartą."); } return View(MVC.Account.Views.Login); }
public virtual ActionResult Login(string returnUrl, string message) { var model = new LogOnModel(); return View(model); }