2018-11-15 10:45:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
2021-06-19 00:41:56 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Password;
|
2018-11-15 10:45:49 +00:00
|
|
|
|
|
|
|
class ForgotPasswordController extends Controller
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Password Reset Controller
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| This controller is responsible for handling password reset emails and
|
|
|
|
| includes a trait which assists in sending these notifications from
|
|
|
|
| your application to your users. Feel free to explore this trait.
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
use SendsPasswordResetEmails;
|
2021-06-19 00:41:56 +00:00
|
|
|
|
|
|
|
public function sendResetLinkEmail(Request $request)
|
|
|
|
{
|
|
|
|
$this->validateEmail($request);
|
|
|
|
|
|
|
|
// If the account is not active, or doesnt exist, we'll send a fake "sent" message.
|
|
|
|
if (! ($x=$this->broker()->getUser($this->credentials($request))) || (! $x->active))
|
|
|
|
return $this->sendResetLinkResponse($request, Password::RESET_LINK_SENT);
|
|
|
|
|
|
|
|
// We will send the password reset link to this user. Once we have attempted
|
|
|
|
// to send the link, we will examine the response then see the message we
|
|
|
|
// need to show to the user. Finally, we'll send out a proper response.
|
|
|
|
$response = $this->broker()->sendResetLink(
|
|
|
|
$this->credentials($request)
|
|
|
|
);
|
|
|
|
|
|
|
|
return $response == Password::RESET_LINK_SENT
|
|
|
|
? $this->sendResetLinkResponse($request, $response)
|
|
|
|
: $this->sendResetLinkFailedResponse($request, $response);
|
|
|
|
}
|
2018-11-15 10:45:49 +00:00
|
|
|
}
|