Closed sjpriest closed 1 month ago
I think what you're looking for is covered here: https://github.com/jazzband/django-two-factor-auth/issues/219#issuecomment-1866161347
There was a PR made to fix this, but there were some issues with tests IIRC: https://github.com/jazzband/django-two-factor-auth/pull/370
Closing this as a duplicate of #219
Ah, yup! Looks like that does cover it. If the pull request is held up maybe some mention of the issue could be made in the documentation? That's a much quicker and easier path to a lot less frustration.
Hi! I don't have any issues to report at the moment, but wanted to make a small suggestion regarding the documentation. I think this could also be a patch that redirects to 'two-factor:setup' as in the 'done' method of the LoginView.
It seems like no one else is encountering this problem, so maybe I took a wrong turn somewhere, but examining the OTP admin classes I found no redirect to the setup page for working admin accounts.
Expected Behavior
I expected to install the package, implement a 2FA admin site, and be redirected to 2FA setup. I have a custom admin account that I only use for the admin page.
Current Behavior
Using AdminSiteOTPRequired to create a custom admin class, the user is continuously redirected to the admin login page when logging in with correct credentials prior to setting up a 2FA device. Ultimately, I simply navigated to /account/two_factor/setup/ in the browser and successfully set up 2FA.
Possible Solution
Change the documentation to indicate how to setup initial 2FA when only applying it a custom admin page.
Steps to Reproduce (for bugs)
Context
I was trying to implement 2FA on a custom admin page and it took me a long time to figure out that there was no automated 2FA setup for this use case.
Your Environment