繁体   English   中英

Laravel Nova电子邮件验证

[英]Laravel Nova Email Verification

我将Nova用作SAAS应用程序的后端,因此基本上转到app.mydoain.com会弹出Nova登录表单。 我想要为此使用标准的Laravel 5.7电子邮件验证(因此,当我添加用户时,他们必须先验证电子邮件才能登录)。

在config / nova.php中,我添加了中间件:

 'middleware' => [
        'verified',
        'web',
        Authenticate::class,
        DispatchServingNovaEvent::class,
        BootTools::class,
        Authorize::class,
    ],

在User.php模型中,我实现了它(这与Webiste文档有何不同?)

<?php

namespace App;

use Illuminate\Auth\MustVerifyEmail;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail as MustVerifyEmailContract;

class User extends Authenticatable implements MustVerifyEmailContract
{
    use MustVerifyEmail, Notifiable;

....

我在web.php中添加了一些路由,仅用于验证(不需要任何其他身份验证)

Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');

在我登录后,它停滞了,或者转到/email/verify/ 在我的数据库中,我已经添加了一个时间戳记,因此它根本不应该转到/email/verify ,并且当它到达/超时时。

如果我从中间件中删除verified的配置,则可以正常工作,但无法进行电子邮件验证检查。

更改中间件的顺序。

'middleware' => [
        'web',
        Authenticate::class,
        'verified',
        DispatchServingNovaEvent::class,
        BootTools::class,
        Authorize::class,
    ],

您的请求必须先通过网络进行。 您很可能由于重定向循环而超时。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM