Skip to content

Commit

Permalink
Update 2fa lib (#5169)
Browse files Browse the repository at this point in the history
* remove CustomTwoFactorRemove

* add setting
  • Loading branch information
matmair authored Jul 4, 2023
1 parent 83afa74 commit f16c8a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 2 additions & 0 deletions InvenTree/InvenTree/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,8 @@
ACCOUNT_DEFAULT_HTTP_PROTOCOL = get_setting('INVENTREE_LOGIN_DEFAULT_HTTP_PROTOCOL', 'login_default_protocol', 'http')
ACCOUNT_LOGOUT_ON_PASSWORD_CHANGE = True
ACCOUNT_PREVENT_ENUMERATION = True
# 2FA
REMOVE_SUCCESS_URL = 'settings'

# override forms / adapters
ACCOUNT_FORMS = {
Expand Down
10 changes: 3 additions & 7 deletions InvenTree/InvenTree/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
CustomEmailView, CustomLoginView,
CustomPasswordResetFromKeyView,
CustomSessionDeleteOtherView, CustomSessionDeleteView,
CustomTwoFactorRemove, DatabaseStatsView, DynamicJsView,
EditUserView, IndexView, NotificationsView, SearchView,
SetPasswordView, SettingsView, auth_request)
DatabaseStatsView, DynamicJsView, EditUserView, IndexView,
NotificationsView, SearchView, SetPasswordView,
SettingsView, auth_request)

admin.site.site_header = "InvenTree Admin"

Expand Down Expand Up @@ -191,10 +191,6 @@
re_path(r'^accounts/social/connections/', CustomConnectionsView.as_view(), name='socialaccount_connections'),
re_path(r"^accounts/password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)/$", CustomPasswordResetFromKeyView.as_view(), name="account_reset_password_from_key"),

# Temporary fix for django-allauth-2fa # TODO remove
# See https://github.com/inventree/InvenTree/security/advisories/GHSA-8j76-mm54-52xq
re_path(r'^accounts/two_factor/remove/?$', CustomTwoFactorRemove.as_view(), name='two-factor-remove'),

# Override login page
re_path("accounts/login/", CustomLoginView.as_view(), name="account_login"),

Expand Down
7 changes: 0 additions & 7 deletions InvenTree/InvenTree/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
PasswordResetFromKeyView)
from allauth.socialaccount.forms import DisconnectForm
from allauth.socialaccount.views import ConnectionsView
from allauth_2fa.views import TwoFactorRemove
from djmoney.contrib.exchange.models import ExchangeBackend, Rate
from user_sessions.views import SessionDeleteOtherView, SessionDeleteView

Expand Down Expand Up @@ -664,9 +663,3 @@ class NotificationsView(TemplateView):
"""View for showing notifications."""

template_name = "InvenTree/notifications/notifications.html"


# Custom 2FA removal form to allow custom redirect URL
class CustomTwoFactorRemove(TwoFactorRemove):
"""Specify custom URL redirect."""
success_url = reverse_lazy("settings")

0 comments on commit f16c8a5

Please sign in to comment.