for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Password;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
use SendsPasswordResetEmails;
public function __construct()
$this->middleware('guest');
}
// Override the sendResetLinkEmail function to provide logging when a reset request is made
public function sendResetLinkEmail(Request $request)
$this->validateEmail($request);
$response = $this->broker()->sendResetLink(
$this->credentials($request)
);
$passOrFail = $response === 'passwords.sent' ? 'successful' : 'failed';
Log::info('A password reset request was made for '.$request->email.'. Response - '.$passOrFail);
return $response == Password::RESET_LINK_SENT
? $this->sendResetLinkResponse($request, $response)
: $this->sendResetLinkFailedResponse($request, $response);