示例#1
0
        public ActionResult SignOn(UserSignOnPageViewModel userSignOnPageViewModel)
        {
            try
            {
                var signOnDetails = this.userSignOnDetailsMapper.MapFrom(userSignOnPageViewModel.Form);
                this.userTasks.SignOn(signOnDetails);
            }
            catch (RulesException exception)
            {
                exception.AddModelStateErrors(this.ModelState, "form");
                return this.View(userSignOnPageViewModel);
            }
            catch (SecurityException)
            {
                this.ModelState.AddModelError("Form.Username", "Incorrect user credentials.");
                this.ModelState.AddModelError("Form.Password", "Incorrect user credentials.");

                return this.View(userSignOnPageViewModel);
            }

            if (string.IsNullOrEmpty(userSignOnPageViewModel.ReturnUrl))
            {
                return this.RedirectToAction("index", "blog");
            }
            return this.Redirect(userSignOnPageViewModel.ReturnUrl);
        }
示例#2
0
 public ActionResult SignOn(string returnUrl)
 {
     var model = new UserSignOnPageViewModel { ReturnUrl = returnUrl };
     return this.View(model);
 }