Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Smiffy's avatar

Reset Password Link returning query string as opposed to "pretty url"

I'm looking to implement some "Forgot Password" functionality to an existing app and looking through the docs at https://laravel.com/docs/8.x/passwords. I'm able to generate a password reset link and redirect the user back to the site however the token needed to reset the password is contained within a query string and not part of the url. I.e.

myssite.com/password-reset?token=whatever...

when it should be

mysite.com/password-reset/whatever

According to the docs, I should be setting up a route to efect the password reset with:

Route::get('/password-reset/{token}')->...

But since the token is in the query string, Laravel doesn't parse out the token for this route.

Not sure if I have missed something fundamental here (very likely!). Any help appreciated!

0 likes
3 replies
Smiffy's avatar

Thanks @s4muel. This is pointing me in the right direction. This is actual a user in addition to the default User model so needs a bit more wiring. I've managed to wire up the necessary providers for auth but this threw me a little. Still curious as to why I'll have to set a custom reset link but it works. Thanks again.

Smiffy's avatar

Have just been using the standard way detailled in the docs.

    use Illuminate\Support\Facades\Password;

    public function sendPasswordResetLink(Request $request)
    {
        $request->validate([
            'email' => 'required|email'
        ]);

        $status = Password::sendResetLink($request->only('email'));

        return $status === Password::RESET_LINK_SENT
            ? back()->with(['status' => $status])
            : back()->withErrors(['email' => 'An error occured']);

    }

Please or to participate in this conversation.