mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
password overwrite
This commit is contained in:
parent
849b71f7e4
commit
15dc01a910
@ -37,7 +37,7 @@ from rest_framework.documentation import include_docs_urls
|
||||
|
||||
from .views import auth_request
|
||||
from .views import IndexView, SearchView, DatabaseStatsView
|
||||
from .views import SettingsView, EditUserView, SetPasswordView, CustomEmailView, CustomConnectionsView
|
||||
from .views import SettingsView, EditUserView, SetPasswordView, CustomEmailView, CustomConnectionsView, CustomPasswordChangeView
|
||||
from .views import CurrencyRefreshView
|
||||
from .views import AppearanceSelectView, SettingCategorySelectView
|
||||
from .views import DynamicJsView
|
||||
@ -165,6 +165,7 @@ urlpatterns = [
|
||||
# overrides of urlpatterns
|
||||
url(r'^accounts/email/', CustomEmailView.as_view(), name='account_email'),
|
||||
url(r'^accounts/social/connections/', CustomConnectionsView.as_view(), name='socialaccount_connections'),
|
||||
url(r'^accounts/password/change/', CustomPasswordChangeView.as_view(), name='account_change_password'),
|
||||
url(r'^accounts/', include('allauth.urls')), # included urlpatterns
|
||||
]
|
||||
|
||||
|
@ -27,7 +27,7 @@ from djmoney.contrib.exchange.models import ExchangeBackend, Rate
|
||||
from allauth.account.forms import AddEmailForm
|
||||
from allauth.socialaccount.forms import DisconnectForm
|
||||
from allauth.account.models import EmailAddress
|
||||
from allauth.account.views import EmailView
|
||||
from allauth.account.views import EmailView, PasswordChangeView
|
||||
from allauth.socialaccount.views import ConnectionsView
|
||||
|
||||
from common.settings import currency_code_default, currency_codes
|
||||
@ -849,6 +849,17 @@ class CustomConnectionsView(LoginRequiredMixin, ConnectionsView):
|
||||
return HttpResponseRedirect(self.success_url)
|
||||
|
||||
|
||||
class CustomPasswordChangeView(LoginRequiredMixin, PasswordChangeView):
|
||||
"""
|
||||
Override of allauths PasswordChangeView to always show the settings but leave the functions allow
|
||||
"""
|
||||
success_url = reverse_lazy("settings")
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# always redirect to settings
|
||||
return HttpResponseRedirect(self.success_url)
|
||||
|
||||
|
||||
class CurrencyRefreshView(RedirectView):
|
||||
"""
|
||||
POST endpoint to refresh / update exchange rates
|
||||
|
Loading…
Reference in New Issue
Block a user