1

I want to have register / login and send password reset on the same page.

I achieve to have register and login on the same page with different input name. But I don't find a way to add password reset input.

I want to call it "reset_email" but on my controller, if I try :

public function sendResetLinkEmail(Request $request)
{
    $this->validateEmail($request);

    // 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(
        $request->only('email')
    );

    return $response == Password::RESET_LINK_SENT
                ? $this->sendResetLinkResponse($response)
                : $this->sendResetLinkFailedResponse($request, $response);
}

/**
 * Validate the email for the given request.
 *
 * @param \Illuminate\Http\Request  $request
 * @return void
 */
protected function validateEmail(Request $request)
{
    $this->validate($request, ['reset_email' => 'required|email']);
}

I've got this error :

We can't find a user with that e-mail address.

Any idea how to use reset_email instead of email for my input name ?

Thank for your help.

1 Answer 1

1

Update your method like this:

...
$response = $this->broker()->sendResetLink(
    ['email' => $request->get('reset_email')]
);
...

This will get your input value and will send it to the password broker with key email, so it will look for users by this column.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.