Laravel user registration and reset password default behavior

Published 1 month ago by hasusozam

In Laravel 5.7 we have this new feature for email verification, the thing is that it doesn't "match" with the current Laravel registration and reset password default behavior. I had to add middleware('verified') to the /home route so it would be protected and only verified users could access, it works, but the thing is that Laravel internally is calling $this->guard()->login($user), so the user is actually logged in, even without the email being verified, and what happens is that the navigation bar still shows his username and the dropdown with his actions.

I was wondering, how to remove that default behavior, instead of logging the user in when he registers I want to show only the email verification message. In the reset password I want to redirect the user to the login page instead of logging automatically.

lol

Snapey
Snapey
1 month ago (1,040,245 XP)

did you upgrade or install fresh?

hasusozam

Install fresh

Snapey
Snapey
1 month ago (1,040,245 XP)
hasusozam

The video doesn't have anything to do with the question, he is just presenting the feature, I want something else.

I was wondering, how to remove that default behavior, instead of logging the user in when he registers I want to show only the email verification message. In the reset password I want to redirect the user to the login page instead of logging automatically.

Snapey
Snapey
1 month ago (1,040,245 XP)

What's it got to do with reset password? Thats a totally independent requirement.

If you don't want to show the user's name in the dropdown on the navbar if they have not authenticated their email, test for it and don't show the user menu.

Fact remains, you need the user to login (username and password) to know which user it is and whether they have verified their password.

Please sign in or create an account to participate in this conversation.