コード例 #1
0
 public ActionResult ChangePassword(ChangePassword model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var recoverCode = new RecoveryCode
             {
                 Email       = model.Email,
                 NewPassword = model.Password,
                 RecoverCode = model.RecoveryCode
             };
             var changeWebPassword = _accessTokenService.ChangePassword(recoverCode);
             return(RedirectToAction("Index").WithSuccess("Password changed successfully."));
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         _log.ErrorFormat("Error in changing user password. Error : {0}", ex.Message);
         _log.Error(ex);
         return(View().WithError("Error in changing user password"));
     }
 }
コード例 #2
0
 public IHttpActionResult ChangePassword(RecoveryCode model)
 {
     try
     {
         var changePassword = _accessTokenService.ChangePassword(model);
         return(Ok(new { Message = "Det nya lösenordet är nu aktiverat." }));
     }
     catch (Exception ex)
     {
         _log.ErrorFormat("Error in change user password. Error : {0}", ex.Message);
         _log.Error(ex);
         throw;
     }
 }