Skip to content

Commit

Permalink
Fix redirect error when forcing allauth login in admin site (#5078)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaeske authored May 18, 2024
1 parent b9f6d88 commit b119eae
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,7 +11,8 @@
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)
Expand Down

0 comments on commit b119eae

Please sign in to comment.