Skip to content

Commit 0a5199f

Browse files
authored
Improve exception thrown when user does not exists
The previous exception was Runtime; since attackers perform batch requests on this services with random emails, logs systems gets flooded with "User not found" messages, which are not useful for debugging since this is not a runtime exception as is.
1 parent c5a1e9b commit 0a5199f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/User/Service/PasswordRecoveryService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function run()
5050
$user = $this->query->whereEmail($this->email)->one();
5151

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

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

0 commit comments

Comments
 (0)