0
votes

I am using Nova just as the backend for a SAAS application so basically going to app.mydoain.com just pops up the Nova login form. I want Laravel 5.7 Email Verification that comes standard in use for this (so when I add a user they have to verify the email before the can login).

In config/nova.php I added the middleware:

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

In User.php model I implemented it (which is done differently than there 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;

....

I added some routes in web.php for just verification (dont need any other auth)

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');

After I login it just stalls out and either goes to /email/verify or /. In my db I have already added a timestamp so it shouldn't go to /email/verify at all and when it goes to / it times-out.

If i remove verified from the middleware in the config it works fine, but no email verification check.

1

1 Answers

2
votes

Change the order of the middlewares.

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

Your request must go through web first. Most likely you are getting the timeout because of a redirect loop.