Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 6.0 - Custom email verification: temporarySignedRoute() URL not working with new route

I'm trying to upgrade to Laravel 6 from 5.8. We're using a custom verification email Notification with the following code to get the verification URL:

URL::temporarySignedRoute(
    'verification.verify', 
    Carbon::now()->addMinutes(60), 
    [
        'id' => $notifiable->getKey(),
    ]
);

This seems to generate an URL that does not work with the new route (check this), for example:

http://host/email/verify/38?expires=1574602925&signature=4410c2230623619633be56d3641814cea3c77236bf8435cba88fc102a35d3dc4

I couldn't find anything on that specific topic online so far, so I'd appreciate any help to get this to work in Laravel 6.

Thanks in advance.

like image 297
Pelle Avatar asked Nov 24 '19 13:11

Pelle


1 Answers

Okay, I found the solution in:

vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php

Had to change the code to:

return URL::temporarySignedRoute(
    'verification.verify',
    Carbon::now()->addMinutes(60),
    [
        'id' => $notifiable->getKey(),
        'hash' => sha1($notifiable->getEmailForVerification()),
    ]
);
like image 162
Pelle Avatar answered Oct 19 '22 01:10

Pelle