From f96f8db957ce2d4ac2f3c1f84fed4cb0f171688c Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 9 Oct 2023 13:43:34 +0200 Subject: [PATCH] creating user sections base --- idhub/forms.py | 20 ------------ idhub/mixins.py | 7 ++++- idhub/templates/idhub/base.html | 28 ++++++++++------- idhub/templates/idhub/user_credentials.html | 5 +++ .../idhub/user_credentials_presentation.html | 5 +++ .../idhub/user_credentials_required.html | 5 +++ idhub/templates/idhub/user_dashboard.html | 4 --- idhub/templates/idhub/user_gdpr.html | 5 +++ idhub/templates/idhub/user_identities.html | 5 +++ idhub/templates/idhub/user_profile.html | 5 +++ idhub/templates/idhub/user_roles.html | 5 +++ idhub/urls.py | 31 ++++++++++++++++--- idhub/views_admin.py | 12 ------- idhub/views_user.py | 12 ------- 14 files changed, 83 insertions(+), 66 deletions(-) delete mode 100644 idhub/forms.py create mode 100644 idhub/templates/idhub/user_credentials.html create mode 100644 idhub/templates/idhub/user_credentials_presentation.html create mode 100644 idhub/templates/idhub/user_credentials_required.html create mode 100644 idhub/templates/idhub/user_gdpr.html create mode 100644 idhub/templates/idhub/user_identities.html create mode 100644 idhub/templates/idhub/user_profile.html create mode 100644 idhub/templates/idhub/user_roles.html delete mode 100644 idhub/views_admin.py delete mode 100644 idhub/views_user.py diff --git a/idhub/forms.py b/idhub/forms.py deleted file mode 100644 index 2eeb961..0000000 --- a/idhub/forms.py +++ /dev/null @@ -1,20 +0,0 @@ -from django.contrib.auth.forms import AuthenticationForm -from django.contrib.auth import authenticate - - -class LoginForm(AuthenticationForm): - - def clean(self): - username = self.cleaned_data.get('username') - password = self.cleaned_data.get('password') - - if not (username and password): - raise self.get_invalid_login_error() - - user = authenticate(username=username, password=password) - - if user is None: - raise self.get_invalid_login_error() - - return self.cleaned_data - diff --git a/idhub/mixins.py b/idhub/mixins.py index 72c3992..2266a19 100644 --- a/idhub/mixins.py +++ b/idhub/mixins.py @@ -1,6 +1,6 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth import views as auth_views -from django.urls import reverse_lazy +from django.urls import reverse_lazy, resolve from django.utils.translation import gettext_lazy as _ from django.views.generic.base import TemplateView from django.shortcuts import redirect @@ -13,6 +13,11 @@ class UserView(LoginRequiredMixin, TemplateView): context = super().get_context_data(**kwargs) context.update({ 'title': self.title, + 'subtitle': self.subtitle, + 'icon': self.icon, + 'section': self.section, + 'path': resolve(self.request.path).url_name, + 'user': self.request.user }) return context diff --git a/idhub/templates/idhub/base.html b/idhub/templates/idhub/base.html index 07391ee..daaf793 100644 --- a/idhub/templates/idhub/base.html +++ b/idhub/templates/idhub/base.html @@ -50,7 +50,7 @@