Laravel 6.0-自定义电子邮件验证:临时签名路由()URL不适用于新路由 [英] Laravel 6.0 - Custom email verification: temporarySignedRoute() URL not working with new route

查看:56
本文介绍了Laravel 6.0-自定义电子邮件验证:临时签名路由()URL不适用于新路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从5.8升级到Laravel 6.我们正在使用带有以下代码的自定义验证电子邮件 Notification 来获取验证URL:

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

这似乎生成了一个与新路由不兼容的URL(

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

到目前为止,我在网上没有找到关于该特定主题的任何内容,因此,我希望能对在Laravel 6中使它发挥作用提供任何帮助.

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.

谢谢.

推荐答案

好的,我在以下位置找到了解决方案:

Okay, I found the solution in:

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

必须将代码更改为:

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

这篇关于Laravel 6.0-自定义电子邮件验证:临时签名路由()URL不适用于新路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆