mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.37k stars 516 forks source link

Signed URL in notification not working with localized route #739

Open YannikFirre opened 4 years ago

YannikFirre commented 4 years ago

Describe the bug When i use signed url on localized url in notification, it's doesn't work.

To Reproduce

Route::group([
    'prefix' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::setLocale(),
    'middleware' => ['localeSessionRedirect'],
], static function () {
Route::get('test', function() {
  return "test";
})
    ->middleware('signed')
    ->name('test');
});

URL::signedRoute('test'); works in view but not in notification when called in toArray method.

Expected behavior The toRoute method called in signedURL return the uri without the locale.

More info:

Thanks for any help :D

juliancc commented 3 years ago

Having the same issue. @YannikFirre did you find a solution?

YannikFirre commented 3 years ago

Hello,

No, finally, my route did not need to be localized.

Sorry :/

MattiaMarchiorato commented 3 years ago

Same problem for us, if we generate a signed route and we visit it without the language code is working, if we add the language code to url we receive a 401 error.

yordivd commented 2 years ago

Same issue here. If it's a queued notification that contains a signedRoute, the route in the email is generated is without the locale en therefore invalid as the server auto redirects it to the currentLocale.

kofeinstyle commented 2 years ago

I have the same problem with the verify route and queued mail. One solution it`s custom logic for UrlGenerator::temporarySignedRoute

wilfredot commented 1 year ago

I fixed it puting LaravelLocalization::setLocale() before to use URL::signedRoute

hatem-elsheref commented 11 months ago

just add the path of route to ignored array in laravellocalization.php config file

'urlsIgnored' => ['/skipped', '/backend/email/verify/*'],