Disable caching on auth views

These pages might contain confidential information, so they should not
be cached.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2019-01-15 11:03:54 +13:00
parent 3cc532f435
commit df189e3455
2 changed files with 6 additions and 0 deletions

View File

@ -15,6 +15,8 @@ from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django_registration import signals
from django_registration.backends.activation.views import RegistrationView
@ -26,6 +28,7 @@ from .models import SecurityQuestion, SecurityQuestionAnswer, UserProfile
from . import tasks
import settings
@method_decorator(never_cache, name='dispatch')
class CaptchaRegistrationView(RegistrationView):
form_class = CaptchaRegistrationForm
@ -68,6 +71,7 @@ class CaptchaRegistrationView(RegistrationView):
return context
@method_decorator(never_cache, name='dispatch')
class CaptchaPasswordResetView(PasswordResetView):
form_class = CaptchaPasswordResetForm

View File

@ -32,6 +32,7 @@ from django.shortcuts import get_list_or_404, get_object_or_404, render
from django.template.loader import get_template
from django.utils.decorators import method_decorator
from django.utils.html import escape
from django.views.decorators.cache import never_cache
from django.views.generic import DetailView, ListView, TemplateView
from django.views.generic.base import RedirectView
from django.views.generic.edit import (CreateView, DeleteView, FormView,
@ -870,6 +871,7 @@ class HistoryListView(ListView):
class EditProfileFormView(SuccessMessageMixin, UpdateView):
form_class = EditProfileForm
@method_decorator(never_cache)
def dispatch(self, request, *args, **kwargs):
self.user = request.user
return super(EditProfileFormView, self).dispatch(request, *args, **kwargs)