Beispiel #1
0
        public ActionResult SubmitLogin(Models.Authentication.LoginModel model, string returnUrl)
        {
            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                returnUrl = "/dashboard/";
            }

            if (ModelState.IsValid)
            {
                if (Membership.ValidateUser(model.Username, model.Password))
                {
                    FormsAuthentication.SetAuthCookie(model.Username, false);
                    UrlHelper helper = new UrlHelper(HttpContext.Request.RequestContext);
                    if (helper.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(Redirect("/"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Invalid username/password");
                }
            }
            return(CurrentUmbracoPage());
        }
Beispiel #2
0
        public ActionResult RenderLogin(string returnUrl)
        {
            var model = new Models.Authentication.LoginModel
            {
                ReturnUrl = returnUrl
            };

            return(PartialView("~/Views/BusinessPages/Authentication/_Login.cshtml", model));
        }