protected override void AfterSetUp() { base.AfterSetUp(); Scenario = new LogOnScenario(); Scenario.Populate(Session); Command = new LogOnUserCommand { UserName = Scenario.JohnDoe.UserName, Password = "******" }; Handler = new LogOnUserCommandHandler(Session); }
public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { var command = new LogOnUserCommand { UserName = model.UserName, Password = model.Password }; AuthenticationResult result = mediator.Execute<LogOnUserCommand, AuthenticationResult>(command); if (result.Success) { formsAuthenticationService.SignIn(result, model.RememberMe); if (Url.IsLocalUrl(returnUrl)) return Redirect(returnUrl); return RedirectToAction("Index", "Home"); } ModelState.AddModelError(string.Empty, "The user name or password provided is incorrect."); } return View(model); }