diff --git a/idhub/mixins.py b/idhub/mixins.py index 68b7344..a87d821 100644 --- a/idhub/mixins.py +++ b/idhub/mixins.py @@ -3,12 +3,21 @@ from django.contrib.auth import views as auth_views from django.urls import reverse_lazy, resolve from django.utils.translation import gettext_lazy as _ from django.shortcuts import redirect +from django.core.cache import cache class UserView(LoginRequiredMixin): login_url = "/login/" wallet = False + def get(self, request, *args, **kwargs): + self.admin_validated = cache.get("KEY_DIDS") + return super().get(request, *args, **kwargs) + + def post(self, request, *args, **kwargs): + self.admin_validated = cache.get("KEY_DIDS") + return super().post(request, *args, **kwargs) + def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context.update({ @@ -19,6 +28,7 @@ class UserView(LoginRequiredMixin): 'path': resolve(self.request.path).url_name, 'user': self.request.user, 'wallet': self.wallet, + 'admin_validated': True if self.admin_validated else False }) return context diff --git a/idhub/templates/idhub/base.html b/idhub/templates/idhub/base.html index 390cb33..52f8f33 100644 --- a/idhub/templates/idhub/base.html +++ b/idhub/templates/idhub/base.html @@ -109,11 +109,13 @@ {% trans 'My credentials' %} + {% if admin_validated %}