private ActionResult TryResetSecurePhrase(ResetSecurePhraseViewModel model)
        {
            try
            {
                var tokenValidation = this.Service.ValidateResetToken(model.ResetToken);
                if (tokenValidation.Type == ResetToken.ResetType.SecurePhrase)
                    return ResetSecurePhraseOnly(model);

                if (tokenValidation.Type == ResetToken.ResetType.Both)
                    return ResetBoth(model);

                throw new Exception();
            }
            catch (InvalidResetTokenException)
            {
                AddModelStateError(GlobalStrings.ResetTokenIsInvalid);
            }
            catch (WeakSecurePhraseException)
            {
                AddModelStateError(GlobalStrings.WeakSecurePhrase);
            }
            catch (WeakPasswordException)
            {
                AddModelStateError(GlobalStrings.WeakPassword);
            }
            catch (Exception)
            {
                AddModelStateError(GlobalStrings.SomethingWentWrong);
            }

            return View(model);
        }
 public ActionResult ResetSecurePhrase(ResetSecurePhraseViewModel model)
 {
     if (ModelState.IsValid)
         return TryResetSecurePhrase(model);
     
     // If we got this far, something failed, redisplay form
     return View(model);
 }
        private ActionResult ResetSecurePhraseView(string resetToken)
        {
            var model = new ResetSecurePhraseViewModel()
            {
                ResetToken = resetToken,
            };

            return View(model);
        }
 private ActionResult ResetBoth(ResetSecurePhraseViewModel model)
 {
     var password = GetPasswordFromSession();
     this.Service.FinishActivateUser(model.ResetToken, password, model.SecurePhrase);
     RemovePasswordFromSession();            
     return RedirectToAction("ResetBothConfirmation");
 }
 private ActionResult ResetSecurePhraseOnly(ResetSecurePhraseViewModel model)
 {
     this.Service.FinishResetSecurePhrase(model.ResetToken, model.SecurePhrase);
     return RedirectToAction("ResetSecurePhraseConfirmation");
 }