public ActionResult LogIn(UserViewModel userModel, string returnUrl) { // Check validation if (!ModelState.IsValid) { // Wrong data // Return same view with the same object return View(userModel); } // Valid Data -> Authenticate if (MembershipWrapper.ValidateUser(userModel.UserName, userModel.Password)) { // Set cookie if it is a valid user FormsAuth.SetAuthCookie(userModel.UserName, false); return Redirect(returnUrl ?? Url.Action("index", "admin")); } // If the authentication fails TempData[vinCMS.Infraestructure.Constants.VIEW_MESSAGE_ERROR] = ERROR_INCORRECT_LOGIN; return View(userModel); }
public void GivenAUserViewModel() { UserViewModel = new UserViewModel(); UserViewModelFilled = new UserViewModel { UserName = "******", Password = "******"}; }