예제 #1
0
        public ActionResult LogOn(LogOnViewModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var userModel = _accountService.LogOn(model.Login.Trim(), model.Password.Trim());

                if (userModel != null)
                {
                    FormsAuthentication.SetAuthCookie(model.Login, false);
                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                        && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return Redirect(returnUrl);
                    }

                    return RedirectToAction("Index", "Home");
                }
            }

            return View(model);
        }
예제 #2
0
        public ActionResult LogOn()
        {
            var viewModel = new LogOnViewModel();

            return View(viewModel);
        }