forked from ungleich-public/dynamicweb
Accept GET on logout again, the pages link to it with plain links and Django 5 made LogoutView POST-only
This commit is contained in:
parent
5bf3d13ae4
commit
7c0db56dc2
4 changed files with 15 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from django.urls import re_path
|
||||
from utils.views import LogoutView
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.contrib.auth import views as auth_views
|
||||
|
||||
|
|
@ -24,7 +25,7 @@ urlpatterns = [
|
|||
re_path(_(r'contact/?$'), ContactView.as_view(), name='contact'),
|
||||
re_path(_(r'login/?$'), LoginView.as_view(), name='login'),
|
||||
re_path(_(r'signup/?$'), SignupView.as_view(), name='signup'),
|
||||
re_path(r'^logout/?$', auth_views.LogoutView.as_view(
|
||||
re_path(r'^logout/?$', LogoutView.as_view(
|
||||
next_page='/digitalglarus/login?logged_out=true'), name='logout'),
|
||||
re_path(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'),
|
||||
re_path(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from django.urls import re_path
|
||||
from utils.views import LogoutView
|
||||
from django.contrib.auth import views as auth_views
|
||||
|
||||
from utils.views import SSHKeyCreateView, AskSSHKeyView
|
||||
|
|
@ -71,7 +72,7 @@ urlpatterns = [
|
|||
name='reset_password'),
|
||||
re_path(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
|
||||
PasswordResetConfirmView.as_view(), name='reset_password_confirm'),
|
||||
re_path(r'^logout/?$', auth_views.LogoutView.as_view(
|
||||
re_path(r'^logout/?$', LogoutView.as_view(
|
||||
next_page='/hosting/login?logged_out=true'), name='logout'),
|
||||
re_path(r'^validate/(?P<validate_slug>.*)/$',
|
||||
SignupValidatedView.as_view(), name='validate')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from django.urls import re_path
|
||||
from utils.views import LogoutView
|
||||
from django.contrib.auth import views as auth_views
|
||||
|
||||
from .views import LandingView, LoginView, SignupView, PasswordResetView,\
|
||||
|
|
@ -11,7 +12,7 @@ urlpatterns = [
|
|||
re_path(r'^$', LandingView.as_view(), name='landing'),
|
||||
re_path(r'^login/?$', LoginView.as_view(), name='login'),
|
||||
re_path(r'^signup/?$', SignupView.as_view(), name='signup'),
|
||||
re_path(r'^logout/?$', auth_views.LogoutView.as_view(
|
||||
re_path(r'^logout/?$', LogoutView.as_view(
|
||||
next_page='/nosystemd/login?logged_out=true'), name='logout'),
|
||||
re_path(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'),
|
||||
re_path(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from django.shortcuts import render
|
|||
from django.utils.encoding import force_bytes
|
||||
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.cache import cache_control
|
||||
from django.views.generic import FormView, CreateView
|
||||
|
|
@ -267,4 +268,11 @@ class AskSSHKeyView(SSHKeyCreateView):
|
|||
|
||||
def post(self, request, *args, **kwargs):
|
||||
self.success_url = self.request.session.get("order_confirm_url")
|
||||
return super(AskSSHKeyView, self).post(self, request, *args, **kwargs)
|
||||
return super(AskSSHKeyView, self).post(self, request, *args, **kwargs)
|
||||
|
||||
class LogoutView(auth_views.LogoutView):
|
||||
"""Django 5 dropped logging out with GET, but the logout links of the pages are plain links"""
|
||||
http_method_names = ['get', 'post', 'options']
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return self.post(request, *args, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue