Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.4] Reset password loses old input #17644

Closed
tylercubell opened this issue Jan 29, 2017 · 2 comments
Closed

[5.4] Reset password loses old input #17644

tylercubell opened this issue Jan 29, 2017 · 2 comments

Comments

@tylercubell
Copy link

tylercubell commented Jan 29, 2017

  • Laravel Version: 5.4.0
  • PHP Version: 7.1
  • Database Driver & Version: N/A

Description:

Old input data isn't being preserved.

SendsPasswordResetEmails@sendResetLinkFailedResponse should match ResetsPasswords@sendResetFailedResponse and use:

return redirect()->back()
            ->withInput($request->only('email'))
            ->withErrors(['email' => trans($response)]);

instead of this:

return back()->withErrors(
    ['email' => trans($response)]
);

Also, I don't understand how ResetsPasswords@showResetForm gets email when the route looks like:

$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
public function showResetForm(Request $request, $token = null)
{
    return view('auth.passwords.reset')->with(
        ['token' => $token, 'email' => $request->email]
    );
}

Also, ForgotPasswordController should have:

protected $redirectTo = '/home';

since it also redirects like LoginController and RegisterController.

Also, the password reset email escapes <br> after Regards,.

I don't know exactly what's happening with #17499 so I didn't make a PR for this.

@jerguslejko
Copy link
Contributor

It's usually better to submit these things as a PR.

Also, you can access query string params through the request object.

/password/reset/XXXXX?email=hello 

can be accessed like this:

$request->email

@jafar690
Copy link

@tylercubell just overide the sendResetLinkFailedResponse function in the ForgotPasswordController like this

    /**
     * Get the response for a failed password reset link.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  string  $response
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
     */
    protected function sendResetLinkFailedResponse(Request $request, $response)
    {
        return back()->withErrors(
            ['email' => trans($response)]
        )->withInput(\Input::all());
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants