MattB's avatar
Level 2

Password reset issue

So, I have a password reset view which relies on a variable being passed into it. I tried to use the below Route but it meant that when I go to the "Login" link, the button for "Forgot Your Password" is missing:

Route::get('/password/reset', 'Auth\ResetPasswordController@showResetForm')->name('reset');

When I remove that route, the button comes back but of course, the link complains about a missing variable.

The function in the controller is:

public function showResetForm()
    {
        $categoryMenu = Categories::all();
        return view('auth.passwords.reset', compact('categoryMenu'));
    }
0 likes
4 replies
Sti3bas's avatar

@mattb if you're using default view, you should also pass token and email.

public function showResetForm(Request $request, $token = null)
{
    return view('auth.passwords.reset', [
        'categoryMenu' => Categories::all(),
        'token' => $token,
        'email' => $request->email,
    ]);
}
MattB's avatar
Level 2

Is this something just native to Laravel 6 or does 5.8 have it?

Snapey's avatar

its been in Laravel for many years, probably since version 3

Please or to participate in this conversation.