Visanduma / nova-two-factor

Laravel nova in-dashboard 2FA feature
56 stars 31 forks source link

OTP Nova View #4

Closed CodeWithDennis closed 2 years ago

CodeWithDennis commented 2 years ago

It seems like it will never ask for my OTP when logging in. Am i missing something?

if (auth()->guest() || $authenticator->isAuthenticated()) { return $next($request); }

Looks like something here maybe?

lahirulhr commented 2 years ago

Hi

Did you add middleware to nova config

\Visanduma\NovaTwoFactor\Http\Middleware\TwoFa::class

CodeWithDennis commented 2 years ago

Yes, i did.

Edit: I even tried again from scratch and when i logout and login im not getting any prompt/view.

lahirulhr commented 2 years ago

I'm unable to reproduce the issue. please make sure Nova Two factor is

1) Enabled by config (.env) 2) Enabled by Nova dashboard settings

CodeWithDennis commented 2 years ago
Schermafbeelding 2022-08-30 om 08 34 23

Schermafbeelding 2022-08-30 om 08 34 30

Schermafbeelding 2022-08-30 om 08 34 51

Edit:

When i dumpdie in the middleware it does pass through it so thats a good thing.

Did all those, see screenshots.

lahirulhr commented 2 years ago

All things looks good.

Please make sure User model has used Visanduma\NovaTwoFactor\ProtectWith2FA trait

Also try to remove old 2fa record from database table

CodeWithDennis commented 2 years ago
Schermafbeelding 2022-08-31 om 08 46 20

I also have that, im really confused whats going on. Can it be conflicting?

lahirulhr commented 2 years ago

it may not conflicting with others but i guess this issue is related to middleware. let's try to find out what's going on.

try to diedump following things before first if condition in middleware

auth()->user()->twoFa

CodeWithDennis commented 2 years ago

Hi,

I made a small clip for you to check i hope it helps:

[removed link]

lahirulhr commented 2 years ago

Thank you for clip. we tried with two fresh Nova 4 projects & it still work without any issue.

unfortunately i'm unable to reproduce the issue as yours. if you have any special environment setup please let me know. for further support you can contact us directly via info@visanduma.com

CodeWithDennis commented 2 years ago

Alright, thanks for trying ill take a deeper look on my end what might be going on.

marlocorridor commented 2 years ago

Alright, thanks for trying ill take a deeper look on my end what might be going on.

Hi, I'm experiencing. No prompt for 2FA.

I will try clearing the caches.

marlocorridor commented 2 years ago

I run the following commands:

now fixed

CodeWithDennis commented 2 years ago

I run the following commands:

  • artisan config:cache
  • artisan optimize:clear

now fixed

I tried your fix but still not getting a prompt.

marlocorridor commented 2 years ago

You could verify if any middleware codes are executed. I tried using dd or try to Log messages.

Before I clear the caches, they are not executed.