Skip to content

Commit cad7ad2

Browse files
committed
fixing the password reset logic and adding php stan config
1 parent 4559f31 commit cad7ad2

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

app/Http/Controllers/Auth/PasswordResetLinkController.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,13 @@ public function store(Request $request): RedirectResponse
3333
'email' => 'required|email',
3434
]);
3535

36-
// We will send the password reset link to this user. Once we have attempted
37-
// to send the link, we will examine the response then see the message we
38-
// need to show to the user. Finally, we'll send out a proper response.
39-
$status = Password::sendResetLink(
36+
// We will send the password reset link to this user if the email exists
37+
Password::sendResetLink(
4038
$request->only('email')
4139
);
4240

43-
if ($status == Password::ResetLinkSent) {
44-
return back()->with('status', __($status));
45-
}
46-
47-
throw ValidationException::withMessages([
48-
'email' => [trans($status)],
49-
]);
41+
// We want to always return a 200 response, even if the user is not found. This is a
42+
// security measure to prevent email accounts from being discovered
43+
return back()->with('status', __('If that email exists in our system, a reset link was sent.'));
5044
}
5145
}

phpstan.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
includes:
2+
- vendor/larastan/larastan/extension.neon
3+
4+
parameters:
5+
6+
paths:
7+
- app/
8+
9+
# Level 9 is the highest level
10+
level: 5

0 commit comments

Comments
 (0)