node-google-authenticator
node-google-authenticator copied to clipboard
loophole in the process
Hi!
I don't think this implementation is working. Let me explain:
- register
- login
- generate qr (read it with the app, etc)
- log out
then:
- login
- open up the google auth app
- sent the request with the code to
/2fa/authenticate, it will every time throws the
WrongAuthenticationTokenException()
in the middleware.
And the reason for that is the following:
this condition:
!omitSecondFactor &&
user.isTwoFactorAuthenticationEnabled &&
!isSecondFactorAuthenticated
will always evaluate to True because where this value: isSecondFactorAuthenticated should be flagged to true, the function never reaches, because we are keep getting that error i just mentioned above.
This Truevalue of that variable being set in the createToken method (the 2nd parameter, which is set to false by default), However, it's being called with true, in the secondFactorAuthentication method, BUT we are never getting there as mentioned above.