diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cebe7c3..9197825c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## dev + +- Enh: Changed exception thrown in PasswordRecoveryService from `RuntimeException` to `NotFoundException`. (eseperio) + ## 1.6.3 Mar 18th, 2024 - Fix: Update last_login_at and last_login_ip on social networt authenticate (e.luhr) diff --git a/src/User/Service/PasswordRecoveryService.php b/src/User/Service/PasswordRecoveryService.php index 0e5b5978..a9e388ac 100644 --- a/src/User/Service/PasswordRecoveryService.php +++ b/src/User/Service/PasswordRecoveryService.php @@ -19,6 +19,7 @@ use Da\User\Traits\ModuleAwareTrait; use Exception; use Yii; +use yii\web\NotFoundHttpException; class PasswordRecoveryService implements ServiceInterface { @@ -50,7 +51,7 @@ public function run() $user = $this->query->whereEmail($this->email)->one(); if ($user === null) { - throw new \RuntimeException('User not found.'); + throw new NotFoundHttpException(Yii::t('usuario', 'User not found')); } $token = TokenFactory::makeRecoveryToken($user->id);