Ejemplo n.º 1
0
        public ActionResult LogOn(AuthorizationModel model)
        {
            //if (authenticationService.IsValid(model.Login, model.Password)) // валидируем пользователя
            {

                FormsAuthentication.SetAuthCookie(model.Login, true); // выставляем куки для авторизованных лиц
                if (!String.IsNullOrEmpty(model.ReturnUrl))
                {
                    return Redirect(model.ReturnUrl);
                }
                return RedirectToAction("Index", "Home");
            }

            ModelState.AddModelError("", "Неверное имя пользователя или пароль");

            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult LogOnPartial(AuthorizationModel model = null)
        {
            if (User.Identity.IsAuthenticated)
            {
                return PartialView("PartialUserInfo", new PartialUserInfo { Name = User.Identity.Name });
            }

            return PartialView(model ?? new AuthorizationModel());
        }