Exemplo n.º 1
0
        public ActionResult Login(LoginViewModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (authentication.Authenticate(model.UserName, model.Password))
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, false);
                    return(Redirect(returnUrl ?? Url.Action("Index", "Admin")));
                }
                else
                {
                    ModelState.AddModelError("", "Incorrect user name or password");
                    return(View(model));
                }
            }



            return(View(model));
        }