Skip to content

Commit

Permalink
[#2076] Fix admin index with 2fa
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-sigma committed Feb 6, 2024
1 parent e7a0507 commit 314d30f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/open_inwoner/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@
ADMIN_INDEX_SHOW_REMAINING_APPS = False
ADMIN_INDEX_AUTO_CREATE_APP_GROUP = False
ADMIN_INDEX_SHOW_REMAINING_APPS_TO_SUPERUSERS = False
ADMIN_INDEX_SHOW_MENU = True
ADMIN_INDEX_DISPLAY_DROP_DOWN_MENU_CONDITION_FUNCTION = (
"open_inwoner.utils.django_two_factor_auth.should_display_dropdown_menu"
)


#
# DJANGO-AXES (4.0+)
Expand Down
3 changes: 1 addition & 2 deletions src/open_inwoner/utils/django_two_factor_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
def should_display_dropdown_menu(request) -> bool:
default = default_should_display_dropdown_menu(request)

two_factor_enabled = settings.TWO_FACTOR_PATCH_ADMIN
if not two_factor_enabled:
if settings.DISABLE_2FA:
return default

# never display the dropdown in two-factor admin views
Expand Down

0 comments on commit 314d30f

Please sign in to comment.