So, is the login not suppose to deny access if the auth code is false when a user has 2-factor enabled on their account? +
As it doesn't do it, it'll still allow the user in as long as they have the correct password.
Hey Troxin,
Jamie and I were just chatting in Discord about having the variable set to false, and use true to update it (if it is right) that way it will always deny unless verification passes.
Thoughts?
B.
I'm not sure what you guys are talking about with allowing users in (It doesn't). The modified login.php makes sure the user can't get in. The API is just for setting 2FA up the first time.
Default value in sql for twoEnabled is 0. That means 2FA is disabled for the account. If user logs in and enables 2FA with a correct auth code from their phone, twoEnabled switches to 1 via ajax and api. The next time the user logs in, if he doesn't supply correct code in login form, login.php will set $login to false and not allow login.
I think that library only returns true if it gets a good response but not a bad point.
Yup! You got it! I think that is the safest way tbh! I will give this a shot on my proj here in a little bit.
Let me know what you guys come up with. This is really interesting.
The code I've posted works. I'm using it in production.