Add no-cache directive when generating keypair

There is no cache-control directive in when generating a keypair, which
could cause some browsers to cache the private key.

Uses the @cache_control and @never_cache django caching decorators.

Change-Id: If767ab12e1c78363eabbf41243a714e979fb8374
Closes-Bug: #1463533
This commit is contained in:
Ryan Peters 2015-06-09 14:56:55 -05:00
parent 78216578f0
commit f583d71d9b

View File

@ -23,7 +23,10 @@ from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django import http
from django.template.defaultfilters import slugify # noqa
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import cache_control
from django.views.decorators.cache import never_cache
from django.views.generic import View # noqa
from horizon import exceptions
@ -101,6 +104,9 @@ class DownloadView(views.HorizonTemplateView):
class GenerateView(View):
@method_decorator(cache_control(max_age=0, no_cache=True,
no_store=True, must_revalidate=True))
@method_decorator(never_cache)
def get(self, request, keypair_name=None, optional=None):
try:
if optional == "regenerate":