From 6543ca647e59f483b281591d3e238357268fbf88 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Tue, 4 Jul 2023 19:11:37 +0100 Subject: [PATCH] Allow password reset callback to modify the result (#47641) --- src/Illuminate/Auth/Passwords/PasswordBroker.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index cbbc897abd85..a0d1d194ba9c 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -63,14 +63,14 @@ public function sendResetLink(array $credentials, Closure $callback = null) $token = $this->tokens->create($user); if ($callback) { - $callback($user, $token); - } else { - // Once we have the reset token, we are ready to send the message out to this - // user with a link to reset their password. We will then redirect back to - // the current URI having nothing set in the session to indicate errors. - $user->sendPasswordResetNotification($token); + return $callback($user, $token) ?? static::RESET_LINK_SENT; } + // Once we have the reset token, we are ready to send the message out to this + // user with a link to reset their password. We will then redirect back to + // the current URI having nothing set in the session to indicate errors. + $user->sendPasswordResetNotification($token); + return static::RESET_LINK_SENT; }