mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-24 00:04:13 +03:00
Fix redirect error when forcing allauth login in admin site (#5078)
This commit is contained in:
parent
b9f6d8875e
commit
b119eae9b4
|
@ -1,7 +1,7 @@
|
|||
from allauth.account.decorators import secure_admin_login
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import admin as auth_admin
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .forms import UserAdminChangeForm
|
||||
|
@ -11,7 +11,8 @@ from .models import User
|
|||
if settings.DJANGO_ADMIN_FORCE_ALLAUTH:
|
||||
# Force the `admin` sign in process to go through the `django-allauth` workflow:
|
||||
# https://docs.allauth.org/en/latest/common/admin.html#admin
|
||||
admin.site.login = login_required(admin.site.login) # type: ignore[method-assign]
|
||||
admin.autodiscover()
|
||||
admin.site.login = secure_admin_login(admin.site.login) # type: ignore[method-assign]
|
||||
|
||||
|
||||
@admin.register(User)
|
||||
|
|
Loading…
Reference in New Issue
Block a user