public ActionResult FirstLogOn(FirstLogOnModel model)
 {
     if (ModelState.IsValid)
     {
         Boolean success = true;
         var user = userRepository.GetUserByUsername(model.UserName);
         MembershipUser membershipUser = Membership.GetUser(model.UserName);
         if (user == null)
         {
             ModelState.AddModelError("", "The supplied details are invalid.");
             success = false;
         }
         else if (!membershipUser.ChangePasswordQuestionAndAnswer(model.OldPassword, model.SecurityQuestion, model.SecurityAnswer))
         {
             ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");
             success = false;
         }
         else if (!MembershipService.ChangePassword(model.UserName, model.OldPassword, model.NewPassword))
         {
             ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");
             success = false;
         }
         if (success)
         {
             FormsService.SignIn(model.UserName, model.RememberMe);
             model.Url = GetRedirectURL(model.UserName);
             return PartialView("FirstLogOnContainer", model);
         }
     }
     return PartialView("FirstLogOnContainer", model);
 }
 public ActionResult FirstLogOn()
 {
     FirstLogOnModel model = new FirstLogOnModel();
     if (TempData["username"] != null && TempData["password"] != null && TempData["rememberme"] != null)
     {
         model.UserName = TempData["username"].ToString();
         model.OldPassword = TempData["password"].ToString();
         model.RememberMe = Boolean.Parse(TempData["rememberme"].ToString());
     }
     return View(model);
 }