This topic is locked
[SOLVED]

2FA with email option (Enable 2FA page never goes away)

5/16/2024 1:24:25 PM
PHPRunner General questions
P
PK author

Hello,
I am using 2FA with email option.
When the user logs in for the fist time, he goes through 2FA. The next time same user is logging in its goes back to the 2FA enable page again. (shown belew)

img alt

But rather it should go straight to send the authentication code and then wait for the code (shown because) be cause I assume when the user logged in tthe first time 2FA was enabled so no need to ask to enable again

img alt

I also check my db and the field that holds the 2FA active and 2FA type seem ok

img alt

Am I still missing something?

Thanks for your help

M
MikeT 5/16/2024

Do you have any evnt code running in before or after login Events?
This can disturb the 2factor workflow, had the same thing.

My solution was to let any redirecting and other necessary login code run on the menu page which is set as the landing page.

P
PK author 5/17/2024

Thank you Mike.
I have now moved all my "after successfull login" and "before login" code to "before display" of my dashboard which is my landing page but the problem still persists. After loging in, the verification code arrives by email and after inputting it, it goes to the user profile page to "enable" 2FA. So it should not go to the user profile page to "enable" 2FA again the next time the user logs in, right?
This my 2FA setting page?
img alt
Is there something I'm missing
By the way the username to login is not the email address. It is the EmployeeNumber. And in the 2FA settings I am using the "EmailAdd" field. This is not the problem, is it?

Thanks so much
Percy

M
MikeT 5/21/2024

Really hard to tell without seeing the db and application. Maybe monitor the users table during a test with phpMyAdmin or something else. You need a TOTP and a two_factor field there as far as I remember.

J
JeffDeveloper 5/22/2024

Hi PK

I had the exact same issue.

Apparently, you need to just go to the SQL query in your PHPRunner project. See attached screenshot. Make sure you have the totp and two_factor ticked.
img alt

Then in here by fields tab in the PHPRunner project, leave the two completely unticked.

img alt

And that is what worked for me.

P
PK author 5/22/2024

JeffDeveloper, it was really that simple. Thanks you so much...my client was about to reject the project becuase OTP was not working...so so relieved.

I wonder why this is not in the documentation. The totp field was not created automatically, so I created and added it on the query page with two_factor and that was it.

Thanks agian