Prince Prince - 17 days ago 8x
PHP Question

Change required information to reset user password with Laravel

I am working on a project with Laravel 5.3, I got to a part where for the user to be able to reset his password, the boolean field

in the users table must be
. For this to work, I edited the method
of the file

* Send a reset link to the given user.
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
public function sendResetLinkEmail(Request $request)
$this->validate($request, ['email' => 'required|email']);

* Prevent users who have not confirmed their account from resetting their password
$credentials = ['email' => $request->get('email'), 'confirmed' => 1];

// 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(


* Removed because of the added variable $credentials
// $request->only('email')

if ($response === Password::RESET_LINK_SENT) {
return back()->with('status', trans($response));

// If an error was returned by the password broker, we will get this message
// translated so we can notify a user of the problem. We'll redirect back
// to where the users came from so they can attempt this process again.
return back()->withErrors(
['email' => trans($response)]

Everything is working correctly as I want but I am wondering. The
vendor directory contains the Composer dependencies
, so is it a good idea to edit the file as I did ?
In case, there is better way to do the same thing, kindly share it. Thanks for helping me.


you just override the sendResetLinkEmail method in ForgotPasswordController

class ForgotPasswordController extends Controller

    use SendsPasswordResetEmails;

    public function sendResetLinkEmail(Request $request)
        // implementation