1 year ago

Password reset link, incorrect format and Invalid token - Laravel 5.7 Multi language

Posted 1 year ago by FabioPacifici

Hello everyone, and thanks in advance for your time.

I am working on a multi-language site, and all seems working fine until I started doing the reset password views.

I have two issues, where I would appreciate your help as I didn't manage to figure out what's wrong:

  1. The button inside the password reset email has an incorrect format: localhost/{token}/password/reset instead of localhost/{locale}/password/reset/{token}

  2. Why when I visit the page typing the password reset URL correctly into the browser like localhost/en/password/reset/token-token, and submit the form the validation fails and returns the password reset token is invalid?

On the reset.blade.php view, the request returns the locale “en” instead of the password reset token value.

What would be the best practice here? Should I make a new notification class for the password reset link to fix the point one?

Given that I type the URL manually into the browser, then shouldn't the password reset token validation work as it is?

Inside the web.php routes file I have the following routes:

Route::get('/password/email/', 'Auth\[email protected]')->name('password.email');
        Route::post('/password/email/', 'Auth\[email protected]')->name('password.email');

        Route::get('/password/reset/{token}', 'Auth\[email protected]')->name('password.reset');
        Route::post('/password/reset', 'Auth\[email protected]')->name('password.reset');

The password.reset view looks like posts to the following route:

                    <form method="POST" action="{{ route('password.reset', app()->getLocale()) }}">

The ResetPasswordController:


namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPasswordController extends Controller
    | Password Reset Controller
    | This controller is responsible for handling password reset requests
    | and uses a simple trait to include this behavior. You're free to
    | explore this trait and override any methods you wish to tweak.

    use ResetsPasswords;

     * Where to redirect users after resetting their password.
     * @var string
    protected $redirectTo = '/home';

    public function redirectTo()
        return app()->getLocale() . '/home';

     * Create a new controller instance.
     * @return void
    public function __construct()

Please sign in or create an account to participate in this conversation.