Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

allow dev to set url for login page when not logged in. #73

Open
dllabs opened this issue Mar 17, 2021 · 1 comment
Open

allow dev to set url for login page when not logged in. #73

dllabs opened this issue Mar 17, 2021 · 1 comment

Comments

@dllabs
Copy link

dllabs commented Mar 17, 2021

Trying to access /admin/dump when admin is not logged in now dumps the user to /accounts/login/?next=/admin/dump/, which appears to be hard-wired into the app.

My app has its login page at /admin/login/, not /accounts/login/.

Can we have a setting that lets us change to login page

thanks for a useful app!

John

@jaap3
Copy link
Collaborator

jaap3 commented Mar 17, 2021

Short answer, your issue is solved by configuring LOGIN_URL in your project settings.py.

Longer answers; These views are protected by the user_passes_test decorator from Django (https://docs.djangoproject.com/en/3.1/topics/auth/default/#django.contrib.auth.decorators.user_passes_test), which redirects users failing the test to settings.LOGIN_URL (https://docs.djangoproject.com/en/3.1/ref/settings/#login-url) which default to /accounts/login/ for some reason.

The user_passes_test decorator takes an optional login_url argument. Since django-smuggler is integrated into Django's admin interface it might be an improvement to set this argument to reverse_lazy('admin:login'). Pull requests are welcome.

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

No branches or pull requests

2 participants