Laravel reset password route not working
There are two different things with parameters.
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
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
Related videos on Youtube
Kiow
Updated on June 04, 2022Comments
-
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 worksSo 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 about 6 yearsHow should I then change my code in order to get
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset.token');
to work? -
Muhammad Nauman about 6 yearsHave you customised the email template or using laravel's default?
-
Kiow about 6 yearsI use Laravel default
-
Muhammad Nauman about 6 years
Auth::routes()
are defined inIlluminate/Routing/Router.php
'sauth()
function. compare your route with those routes and it might solve the problem. Laravel defines the token route aspassword.reset