Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling 2FA first time for user does not work if TOTP device name is not 'default' #652

Open
NicoEdge5 opened this issue Sep 7, 2023 · 2 comments

Comments

@NicoEdge5
Copy link

NicoEdge5 commented Sep 7, 2023

Hello everyone,
I am not sure if this has been fixed on a later version but I haven t found anything about it so I thought to post my issue. The bug occurs when for the first time you assign a TOTP device to a user. If the name of the device is not 'default' the user does not get flagged as 2FA enabled and hence the 2FA is not enabled. If instead you change the name of the TOTP device to 'default' or you create a new TOTP device named 'default' then the 2FA gets enabled for the user.

Expected Behavior

Login without 2FA. Create a TOTP device with any name I want. Logout. Login, 2FA required.

Current Behavior

  1. Login without 2FA. Create a TOTP device with any name I want. Logout. Login, 2FA is not requried.
  2. Login without 2FA. Create a TOTP device with 'default' name. Logout. Login, 2FA is required.

Steps to Reproduce (for bugs)

  1. Login with user that has no 2FA enabled and no TOTP Devices assigned
  2. Create TOTP Device with name different from 'default'
  3. Logout
  4. Login again

Context

I would like to be able to name TOTP devices to know where they are used (i.e. authenticator, 1password, ...)

Your Environment

  • Browser and version: tested on many always happens
  • Python version:
  • Django version: 3.1.14
  • django-otp version: 1.1.6
  • django-two-factor-auth version: 1.14.0

If this has been fixed in latest releases would be cool if someone could let me know.
Thanks everybody

EDIT:
I used django-two-factor-auth also on projects with Django version 4.2.X and there I have the same issue so it looks like it was not fixed.

@cpressland
Copy link

I can also replicate this for what it's worth.

@robertvy
Copy link

robertvy commented Aug 5, 2024

I had the same issue. Could not get the package working until I stumbled upon this issue. Naming the first device "default" does the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants