Beispiel #1
0
        public ActionResult Login(User providedUser, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                bool userIsValid = _authorisationProvider.AuthenticateAndLogIn(providedUser.UserName, providedUser.Password);

                if (userIsValid)
                {
                    if (UrlIsValid(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Menu", new { area = "Administration" }));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "The user name  or password is incorrect");
                }
            }

            return(View(providedUser));
        }