Skip to content

Commit 3633402

Browse files
authored
Merge pull request #552 from Eseperio/patch-6
Improve exception thrown when user does not exists
2 parents c5a1e9b + 6c220fb commit 3633402

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## dev
4+
5+
- Enh: Changed exception thrown in PasswordRecoveryService from `RuntimeException` to `NotFoundException`. (eseperio)
6+
37
## 1.6.3 Mar 18th, 2024
48

59
- Fix: Update last_login_at and last_login_ip on social networt authenticate (e.luhr)

src/User/Service/PasswordRecoveryService.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Da\User\Traits\ModuleAwareTrait;
2020
use Exception;
2121
use Yii;
22+
use yii\web\NotFoundHttpException;
2223

2324
class PasswordRecoveryService implements ServiceInterface
2425
{
@@ -50,7 +51,7 @@ public function run()
5051
$user = $this->query->whereEmail($this->email)->one();
5152

5253
if ($user === null) {
53-
throw new \RuntimeException('User not found.');
54+
throw new NotFoundHttpException(Yii::t('usuario', 'User not found'));
5455
}
5556

5657
$token = TokenFactory::makeRecoveryToken($user->id);

0 commit comments

Comments
 (0)