Ejemplo n.º 1
0
 public ActionResult ResetPasswordRequest(ResetPasswordRequestModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _membershipService.RequestPasswordReset(model.Email, BaseSiteUrl(), token => FullUrlForAction("ResetPassword", "Account", new { token }));
             ViewData.AddRequestSuccessMessage(SuccessMessagesResources.ResetPasswdRequestSentInfo);
             return View();
         }
         catch (UserNotExistsException)
         {
             ModelState.AddModelError("email", ValidationResources.EmailNotFoundError);
         }
         catch (DeliveryException ex)
         {
             Logger.Error(ex);
             ModelState.AddModelError("delivery", ValidationResources.ResetInstructionSendingFailedError);
         }
     }
     if (model == null)
         model = new ResetPasswordRequestModel();
     return View(model);
 }