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

"staff_member_required"-solution in documentation (section installation at the end) leads to error for non_staff members #102

Open
Danane84 opened this issue Aug 18, 2020 · 2 comments

Comments

@Danane84
Copy link

In the installation section of the documentation at the very end of the page, the following method is proposed to use the allauth authentication workflow (including two-factor authentication) for access the Django admin site:

admin.site.log = staff_member_required(admin.site.login, login_url = 'accounts/login')
admin.autodiscover()

However, if a registered user, who is not a staff member logs in, the result is an ERR_TOO_MANY_REDIRECTS error. I tried to come up with a solution by looking at the staff_member_required decorator in the django documentation but was not successful. I know it is not a django-allauth-2fa specific question, but since the above code snippet is from the documentation, I thought I give it a try.

@clokep
Copy link
Collaborator

clokep commented Sep 25, 2020

I can't say I've run into this sorry!

@falc410
Copy link

falc410 commented Oct 11, 2020

I have run into the same problem. When a non staffmember tries to access the admin page, he will get this error instead of a forbbiden. This really is quite a problem, since we definitely need to secure the admin page with 2FA and without this code, 2FA is completely bypassed, but with it, normal users just get a browser error.

Danane84 did you come up with a solution by now? Also, when logging in, I am always redirected to the default redirect_login_url from allauth, the next value is ignored (see #105 )

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