PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 4, 2022

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

 February 04, 2022     laravel, laravel-6, php, routing     No comments   

Issue

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.


Solution

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()),
    ]
);


Answered By - Pelle
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing