@@ -37,24 +37,12 @@ public function sendResetLinkEmail(Request $request)
3737 {
3838 $ this ->validateEmail ($ request );
3939
40- // We will send the password reset link to this user. Once we have attempted
41- // to send the link, we will examine the response then see the message we
42- // need to show to the user. Finally, we'll send out a proper response.
43- $ response = $ this ->broker ()->sendResetLink (
44- $ this ->credentials ($ request )
45- );
40+ // Always return the generic "reset link sent" response regardless of the broker's
41+ // actual result. INVALID_USER and RESET_THROTTLED would each reveal whether the
42+ // email belongs to a registered account (the broker only throttles real users).
43+ $ this ->broker ()->sendResetLink ($ this ->credentials ($ request ));
4644
47- // Treat "no such user" and "throttled" the same as a successful send so the
48- // response does not reveal whether the email belongs to a registered account.
49- // The broker only throttles real users, so a throttled response would itself
50- // be an enumeration oracle.
51- if (in_array ($ response , [Password::INVALID_USER , Password::RESET_THROTTLED ], true )) {
52- $ response = Password::RESET_LINK_SENT ;
53- }
54-
55- return $ response === Password::RESET_LINK_SENT
56- ? $ this ->sendResetLinkResponse ($ request , $ response )
57- : $ this ->sendResetLinkFailedResponse ($ request , $ response );
45+ return $ this ->sendResetLinkResponse ($ request , Password::RESET_LINK_SENT );
5846 }
5947
6048 /**
@@ -105,31 +93,6 @@ protected function sendResetLinkResponse(Request $request, $response)
10593 : $ redirect ->with ('status ' , trans ($ response ));
10694 }
10795
108- /**
109- * Get the response for a failed password reset link.
110- *
111- * @param string $response
112- * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
113- */
114- protected function sendResetLinkFailedResponse (Request $ request , $ response )
115- {
116- $ errorRedirect = $ request ->input ('_error_redirect ' );
117-
118- $ redirect = $ errorRedirect && ! URL ::isExternalToApplication ($ errorRedirect )
119- ? redirect ($ errorRedirect )
120- : back ();
121-
122- if ($ request ->wantsJson ()) {
123- throw ValidationException::withMessages ([
124- 'email ' => [trans ($ response )],
125- ]);
126- }
127-
128- return $ redirect
129- ->withInput ($ request ->only ('email ' ))
130- ->withErrors (['email ' => trans ($ response )], 'user.forgot_password ' );
131- }
132-
13396 /**
13497 * Get the broker to be used during password reset.
13598 *
0 commit comments