Laravel reset password route not working

10,547

There are two different things with parameters.

  1. Route Parameters: These are included in the routes with '/' as in your example. You can get them by:

    $request->parameter('parameter_name'); $request->parameters(); // for all parameters

  2. Request Parameters: These are request parameters which attached in the URL after '?'. Parameters are sent this way in GET request. You can get them by:

    $request->input('parameter_name'); $request->all(); // for all parameters

Share:
10,547

Related videos on Youtube

Kiow
Author by

Kiow

Updated on June 04, 2022

Comments

  • Kiow
    Kiow almost 2 years

    I am building custom views to reset passwords. The routes looks like this:

      Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.reset');
      Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
      Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset.token');
      Route::post('password/reset', 'Auth\ResetPasswordController@reset');
    

    In ResetPasswordController.php I have added this:

    //Show form to seller where they can reset password
        public function showResetForm(Request $request, $token = null)
        {
            return view('auth.passwords.reset')->with(
                ['token' => $token, 'email' => $request->email]
            );
        }
    

    The link sent to me looks like this:

    https://myapp.dev/password/reset?451c70284a9d4b41123c4ec3efe83602b6cb955427ac48835200a45980bcf9f3
    

    If I now enter that link I will go straight to the password/reset view and not the password/reset/{token}

    However if I change the link in my broswer to

    https://myapp.dev/password/reset/451c70284a9d4b41123c4ec3efe83602b6cb955427ac48835200a45980bcf9f3 (changing "?" to "/") I it works

    So why doesnt the ? version of the URL work? I am using laravel 5.5

    And since I dotn use the Auth:routes() is there any way to see what routes laravel generates when you use that?

  • Kiow
    Kiow about 6 years
    How should I then change my code in order to get Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('passwor‌​d.reset.token'); to work?
  • Muhammad Nauman
    Muhammad Nauman about 6 years
    Have you customised the email template or using laravel's default?
  • Kiow
    Kiow about 6 years
    I use Laravel default
  • Muhammad Nauman
    Muhammad Nauman about 6 years
    Auth::routes() are defined in Illuminate/Routing/Router.php's auth() function. compare your route with those routes and it might solve the problem. Laravel defines the token route as password.reset