limit access to cache
This commit is contained in:
parent
d45be274ee
commit
e558d9145d
|
@ -68,6 +68,7 @@ class EncryptionKeyForm(forms.Form):
|
||||||
txt = _("Key no valid!")
|
txt = _("Key no valid!")
|
||||||
raise ValidationError(txt)
|
raise ValidationError(txt)
|
||||||
|
|
||||||
|
cache.set("KEY_DIDS", None)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
@ -426,8 +427,7 @@ class ImportCertificateForm(forms.Form):
|
||||||
type=DID.Types.KEY
|
type=DID.Types.KEY
|
||||||
)
|
)
|
||||||
|
|
||||||
pw = cache.get("KEY_DIDS")
|
self._did.set_key_material(key_material)
|
||||||
self._did.set_key_material(key_material, pw)
|
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
|
||||||
|
|
|
@ -701,15 +701,10 @@ class DeleteCredentialsView(Credentials):
|
||||||
VerificableCredential,
|
VerificableCredential,
|
||||||
pk=pk,
|
pk=pk,
|
||||||
)
|
)
|
||||||
status = [
|
self.object.delete()
|
||||||
VerificableCredential.Status.REVOKED,
|
messages.success(self.request, _('Credential deleted successfully'))
|
||||||
VerificableCredential.Status.ISSUED
|
Event.set_EV_CREDENTIAL_DELETED(self.object)
|
||||||
]
|
Event.set_EV_CREDENTIAL_DELETED_BY_ADMIN(self.object)
|
||||||
if self.object.status in status:
|
|
||||||
self.object.delete()
|
|
||||||
messages.success(self.request, _('Credential deleted successfully'))
|
|
||||||
Event.set_EV_CREDENTIAL_DELETED(self.object)
|
|
||||||
Event.set_EV_CREDENTIAL_DELETED_BY_ADMIN(self.object)
|
|
||||||
|
|
||||||
return redirect(self.success_url)
|
return redirect(self.success_url)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.contrib.auth import views as auth_views
|
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.urls import reverse_lazy, resolve
|
from django.urls import reverse_lazy, resolve
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
|
|
@ -6,7 +6,6 @@ import datetime
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
import qrcode
|
import qrcode
|
||||||
import logging
|
|
||||||
import datetime
|
import datetime
|
||||||
import weasyprint
|
import weasyprint
|
||||||
import qrcode.image.svg
|
import qrcode.image.svg
|
||||||
|
@ -34,7 +32,6 @@ from idhub.user.tables import (
|
||||||
DIDTable,
|
DIDTable,
|
||||||
CredentialsTable
|
CredentialsTable
|
||||||
)
|
)
|
||||||
from django.core.cache import cache
|
|
||||||
from idhub.user.forms import (
|
from idhub.user.forms import (
|
||||||
RequestCredentialForm,
|
RequestCredentialForm,
|
||||||
DemandAuthorizationForm,
|
DemandAuthorizationForm,
|
||||||
|
@ -172,7 +169,7 @@ class WaitingView(UserView, TemplateView):
|
||||||
success_url = reverse_lazy('idhub:user_dashboard')
|
success_url = reverse_lazy('idhub:user_dashboard')
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
if cache.get("KEY_DIDS"):
|
if self.admin_validated:
|
||||||
return redirect(self.success_url)
|
return redirect(self.success_url)
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import zlib
|
||||||
|
|
||||||
import pyroaring
|
import pyroaring
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.views.generic.base import TemplateView
|
from django.views.generic.base import TemplateView
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import views as auth_views
|
||||||
|
|
Loading…
Reference in New Issue