patch email-endpoint to use settings view

This commit is contained in:
Matthias 2021-08-31 23:49:31 +02:00
parent 1772348d36
commit 566257881d
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 16 additions and 2 deletions

View File

@ -37,7 +37,7 @@ from rest_framework.documentation import include_docs_urls
from .views import auth_request from .views import auth_request
from .views import IndexView, SearchView, DatabaseStatsView from .views import IndexView, SearchView, DatabaseStatsView
from .views import SettingsView, EditUserView, SetPasswordView from .views import SettingsView, EditUserView, SetPasswordView, CustomEmailView
from .views import CurrencyRefreshView from .views import CurrencyRefreshView
from .views import AppearanceSelectView, SettingCategorySelectView from .views import AppearanceSelectView, SettingCategorySelectView
from .views import DynamicJsView from .views import DynamicJsView
@ -160,7 +160,11 @@ urlpatterns = [
url(r'^api-doc/', include_docs_urls(title='InvenTree API')), url(r'^api-doc/', include_docs_urls(title='InvenTree API')),
url(r'^markdownx/', include('markdownx.urls')), url(r'^markdownx/', include('markdownx.urls')),
url(r'^accounts/', include('allauth.urls')), # SSO
# Single Sign On / allauth
# overrides of urlpatterns
url(r'^accounts/email/', CustomEmailView.as_view(), name='account_email'),
url(r'^accounts/', include('allauth.urls')), # included urlpatterns
] ]
# Server running in "DEBUG" mode? # Server running in "DEBUG" mode?

View File

@ -812,6 +812,16 @@ class SettingsView(TemplateView):
return ctx return ctx
class CustomEmailView(LoginRequiredMixin, EmailView):
"""
Override of allauths EmailView 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): class CurrencyRefreshView(RedirectView):
""" """