7

I originally thought it was a good idea to activate the email verification feature in Laravel but have decided not to use it in the end. However, for some reason, I now get an error message when I remove ['verify' => true] from:

Auth::routes(['verify' => true]);

From what I can remember it's not activated anywhere else (also from reading the docs) but I must be wrong.

Anyway, some guidance would be much appreciated, have search high and low, doing the activation in reverse etc.

This is the error message I get when I remove ['verify' => true].

enter image description here

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
The Ginger Fox
  • 367
  • 1
  • 4
  • 15
  • Could you please add your user model? – rpm192 Mar 01 '19 at 21:35
  • 1
    Are you implementing the `MustVerifyEmail` contract in your `User` (or any `Notifiable`) model? (`class User extends Authenticatable implements MustVerifyEmail { ... }`) – Kenny Horna Mar 01 '19 at 22:01
  • Yes, but I thought that came set up by default and that it was envoked when you passed the verify=true parameter. What should it look like without the email of verification? – The Ginger Fox Mar 01 '19 at 22:37
  • 2
    [Please don't post screenshots of error msg and code](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Edit your question and add the actual text, so that others with the same problem can find it. – Don't Panic Mar 02 '19 at 04:18

3 Answers3

10

To desactivate Email verification :

remove ['verify' => true] from Auth::routes() in web.php
remove "implements MustVerifyEmail" from User Model

  • I do that. Result: "Target class [verified] does not exist.", "exception": "Illuminate\\Contracts\\Container\\BindingResolutionException". – Arthur Shlain Jun 17 '20 at 13:11
  • I turn back 'verified' middleware in kernel.php, now i get error "Your email address is not verified." – Arthur Shlain Jun 17 '20 at 13:16
  • I think it's because i turn off automatic login after registration. Verified middleware return that error "Your email address is not verified." if user not logged in. – Arthur Shlain Jun 17 '20 at 13:21
  • 1
    Solved. To fix need also remove all `verified` middlewares from `routes/web.php` groups – Arthur Shlain Jun 17 '20 at 16:25
3

in AuthController.php comment out // $user->sendEmailVerificationNotification();

in App\Models\User.php comment out // implements MustVerifyEmail

DragonFire
  • 3,722
  • 2
  • 38
  • 51
2

To deactivate Email verification :

  1. Add the below line in web.php
Auth::routes(['verify' => false]);
  1. Remove MustVerifyEmail interface from User Models
class User extends Authenticatable implements MustVerifyEmail
{
 ...
}
class User extends Authenticatable
{
 ...
}
Localhousee
  • 887
  • 1
  • 5
  • 17