我使用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 docs不同?)
<?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
它工作正常,但没有电子邮件验证检查 .
1 回答
我认为您手中最大的帮助是基于存储/日志的laravel日志 . 如果您的网站超时,它应该记录错误...