0

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
  • Did you manage to solve this? Could you explain how you set this up? Commented Sep 29, 2021 at 14:42

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.