From 8bb35a7e6cf334ce1d7cbbe8114ee3f0018fa110 Mon Sep 17 00:00:00 2001 From: varunsaral <42253796+varunsaral@users.noreply.github.com> Date: Fri, 25 Aug 2023 23:09:03 +0530 Subject: [PATCH] feat(account/views): Add never_cache decorator to prevent csrf_token caching * Add never_cache decorator to prevent csrf_token caching * Apply isort for sorted imports --------- Co-authored-by: varun kumar --- allauth/account/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/allauth/account/views.py b/allauth/account/views.py index f9785395a1..98f7e14a38 100644 --- a/allauth/account/views.py +++ b/allauth/account/views.py @@ -9,6 +9,7 @@ from django.shortcuts import redirect from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator +from django.views.decorators.cache import never_cache from django.views.decorators.debug import sensitive_post_parameters from django.views.generic.base import TemplateResponseMixin, TemplateView, View from django.views.generic.edit import FormView @@ -145,6 +146,7 @@ class LoginView( redirect_field_name = "next" @sensitive_post_parameters_m + @method_decorator(never_cache) def dispatch(self, request, *args, **kwargs): return super(LoginView, self).dispatch(request, *args, **kwargs) @@ -230,6 +232,7 @@ class SignupView( success_url = None @sensitive_post_parameters_m + @method_decorator(never_cache) def dispatch(self, request, *args, **kwargs): return super(SignupView, self).dispatch(request, *args, **kwargs)