Two-Factor Authentication SignUp/LogIn

Hi everyone.

I would like to implement two-factor authentication(2FA) to my project.
My project has “django-allauth” so users can login from url localhost/accounts/login.

To impletemet 2FA, I installed “django-two-factor-auth” to my project.
After the installation, login by creating QR code, registering to Google Authenticator, and typing in one-time-password was successful. The login url for this was localhost/account/login.

However, I could still login from localhost/accounts/login without the 2FA.
I would like to force it to use 2FA when logging in. How can I do this?


I’m not quite sure I’m fully understanding your objective here.

Is it:

  • You want to disable the /accounts/login url
    • This can be done by removing it from your file
  • You want /accounts/login to do the same thing as /account/login
    • This can be done by changing your file to point /accounts to the same views as /account
  • You want /accounts/login to do what it used to do, plus 2FA?

Dear KenWhitesell,

Thank you so much!
I tried the second option (changing file) and it was successful!

I appreciate your help very much.
Thank you!