Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

Email verification not working as expected #757

Closed hagealex closed 7 months ago

hagealex commented 7 months ago

Hello everyone!

Recently I updated from Backpack 5 to Backpack 6. So far it's working great. Now I wanted to enable email verification and I'm facing some issues. I followed the steps from the documentation.

After enabling setup_email_validation_routes, when I log in with a (test) user who hasn't validated the email: I am stuck at the login view. After submitting my credentials I am redirected back to the login view.

I then disabled the setting. After login in with the same user I get this error: image I expected that I get the verify-email view from the theme (I use coreiuiv4).

Then I changed my route to use backpack_view() instead of view() and got this: image

I reverted to view() and copied the view file from vendor/backpack/theme-coreuiv4/... into resources/auth/

Now I get the view but because I set this setting setup_email_validation_routes to false I am directed to the dasboard after login.

So my question: What am I doing wrong? I followed all steps from the documentation and can't see a point that I missed. As its a new feature I'm pretty sure it works great after a fresh install. But as I just updated from Backpack 5 maybe this is an issue related to that?

These are the versions I use:

### LARAVEL VERSION:
10.32.1.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.1
backpack/crud: 6.3.0
backpack/generators: v4.0.2
backpack/permissionmanager: 7.1.1
backpack/pro: 2.0.18
backpack/theme-coreuiv4: 1.1.1
pxpm commented 7 months ago

Hey @hagealex I was not able to reproduce your issue.

I've just tested the full process using coreui-v4 and it worked as expected.

image

From what I see in the screenshot you are somehow overwriting the core backpack routes, so I'd suggest you have a look at the functions you are overwriting to check where could be the error.

We setup those routes in https://github.com/Laravel-Backpack/CRUD/blob/4c7030524540d34ca32db367a48ae03d34c14505/src/routes/backpack/base.php#L42

From a quick look, this is what we return: return view(backpack_view('auth.verify-email'));

I am closing this as I don't think this is a Backpack bug. I may be wrong, have been sometimes in the past, if that's the case, please re-open or reply and we can continue this conversation.

Cheers

hagealex commented 7 months ago

@pxpm Aaah now I got it. I misunderstood that all the email verification routes are then handled by Backpack. I had them set up in my own routes file according to the Laravel documentation. This caused the weird behavior.

Thank you for the hint!