From fc226bd5df7a48b872163bc03fb55a51999dfd7b Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 18 Oct 2023 17:30:11 +0200 Subject: [PATCH 1/4] send email for put your password --- idhub/admin/views.py | 14 +- idhub/email/__init__.py | 0 idhub/email/views.py | 55 +++++ idhub/templates/auth/login.html | 204 +++++------------- idhub/templates/auth/login_base.html | 114 ++++++++++ idhub/templates/auth/password_reset.html | 27 +++ .../auth/password_reset_complete.html | 16 ++ .../auth/password_reset_confirm.html | 36 ++++ idhub/templates/auth/password_reset_done.html | 15 ++ .../registration/activate_user_email.html | 31 +++ .../registration/activate_user_email.txt | 19 ++ .../registration/activate_user_subject.txt | 4 + .../registration/password_reset_email.html | 30 +++ .../registration/password_reset_email.txt | 14 ++ .../registration/password_reset_subject.txt | 3 + idhub/urls.py | 29 +++ trustchain_idhub/settings.py | 2 + 17 files changed, 456 insertions(+), 157 deletions(-) create mode 100644 idhub/email/__init__.py create mode 100644 idhub/email/views.py create mode 100644 idhub/templates/auth/login_base.html create mode 100644 idhub/templates/auth/password_reset.html create mode 100644 idhub/templates/auth/password_reset_complete.html create mode 100644 idhub/templates/auth/password_reset_confirm.html create mode 100644 idhub/templates/auth/password_reset_done.html create mode 100644 idhub/templates/idhub/admin/registration/activate_user_email.html create mode 100644 idhub/templates/idhub/admin/registration/activate_user_email.txt create mode 100644 idhub/templates/idhub/admin/registration/activate_user_subject.txt create mode 100644 idhub/templates/idhub/admin/registration/password_reset_email.html create mode 100644 idhub/templates/idhub/admin/registration/password_reset_email.txt create mode 100644 idhub/templates/idhub/admin/registration/password_reset_subject.txt diff --git a/idhub/admin/views.py b/idhub/admin/views.py index 0e6f122..13031b0 100644 --- a/idhub/admin/views.py +++ b/idhub/admin/views.py @@ -1,4 +1,5 @@ import logging +from smtplib import SMTPException from django.utils.translation import gettext_lazy as _ from django.views.generic.base import TemplateView @@ -9,6 +10,7 @@ from django.urls import reverse_lazy from django.contrib import messages from idhub.models import Membership, Rol, Service, UserRol from idhub.mixins import AdminView +from idhub.email.views import NotifyActivateUserByEmail from idhub.admin.forms import ( ProfileForm, MembershipForm, @@ -121,7 +123,7 @@ class AdminPeopleEditView(AdminPeopleView, UpdateView): success_url = reverse_lazy('idhub:admin_people_list') -class AdminPeopleRegisterView(People, CreateView): +class AdminPeopleRegisterView(NotifyActivateUserByEmail, People, CreateView): template_name = "idhub/admin/people_register.html" subtitle = _('People Register') icon = 'bi bi-person' @@ -137,6 +139,16 @@ class AdminPeopleRegisterView(People, CreateView): ) return self.success_url + def form_valid(self, form): + user = form.save() + messages.success(self.request, _('The account is created successfully')) + if user.is_active: + try: + self.send_email(user) + except SMTPException as e: + messages.error(self.request, e) + return super().form_valid(form) + class AdminPeopleMembershipRegisterView(People, CreateView): template_name = "idhub/admin/people_membership_register.html" diff --git a/idhub/email/__init__.py b/idhub/email/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/idhub/email/views.py b/idhub/email/views.py new file mode 100644 index 0000000..ae73ebf --- /dev/null +++ b/idhub/email/views.py @@ -0,0 +1,55 @@ +from django.conf import settings +from django.template import loader +from django.core.mail import EmailMultiAlternatives +from django.contrib.auth.tokens import default_token_generator +from django.contrib.sites.shortcuts import get_current_site +from django.utils.encoding import force_bytes +from django.utils.http import urlsafe_base64_encode + + +class NotifyActivateUserByEmail: + def get_email_context(self, user): + """ + Define a new context with a token for put in a email + when send a email for add a new password + """ + protocol = 'https' if self.request.is_secure() else 'http' + current_site = get_current_site(self.request) + site_name = current_site.name + domain = current_site.domain + context = { + 'email': user.email, + 'domain': domain, + 'site_name': site_name, + 'uid': urlsafe_base64_encode(force_bytes(user.pk)), + 'user': user, + 'token': default_token_generator.make_token(user), + 'protocol': protocol, + } + return context + + def send_email(self, user): + """ + Send a email when a user is activated. + """ + context = self.get_email_context(user) + subject_template_name = 'idhub/admin/registration/activate_user_subject.txt' + email_template_name = 'idhub/admin/registration/activate_user_email.txt' + html_email_template_name = 'idhub/admin/registration/activate_user_email.html' + subject = loader.render_to_string(subject_template_name, context) + # Email subject *must not* contain newlines + subject = ''.join(subject.splitlines()) + body = loader.render_to_string(email_template_name, context) + from_email = settings.DEFAULT_FROM_EMAIL + to_email = user.email + + email_message = EmailMultiAlternatives( + subject, body, from_email, [to_email]) + html_email = loader.render_to_string(html_email_template_name, context) + email_message.attach_alternative(html_email, 'text/html') + if settings.DEVELOPMENT: + print(to_email) + print(body) + return + + email_message.send() diff --git a/idhub/templates/auth/login.html b/idhub/templates/auth/login.html index 6f43260..28c199e 100644 --- a/idhub/templates/auth/login.html +++ b/idhub/templates/auth/login.html @@ -1,162 +1,54 @@ - +{% extends "auth/login_base.html" %} {% load i18n static %} - - - - {% block head %} - {% block meta %} - - - - - - {% endblock %} - {% block title %}{% if title %}{{ title }} – {% endif %}IdHub{% endblock %} +{% block login_content %} +
+ {% csrf_token %} + - - {% block style %} - - - - - - - - - - {% endblock %} - {% endblock %} - - - - -
-
-
- {% block messages %} - {% for message in messages %} - - {% endfor %} - {% endblock messages %} - -
-
-
-
- {% block branding %} -

- Pangea.org - Internet etic i solidari -

- {% endblock %} -
-
- - {% csrf_token %} - - -
-
- - {% if form.username.errors %} -

- {{ form.username.errors|striptags }} -

- {% endif %} -
-
- -
-
- - {% if form.password.errors %} -

- {{ form.password.errors|striptags }} -

- {% endif %} -
-
- - {% if form.non_field_errors %} - {% for error in form.non_field_errors %} -
{{ error }}
- {% endfor %} - {% endif %} - - - -
- -
- -
-
- - -
-
- - -
-
- - - - - - +
+
+ + {% if form.password.errors %} +

+ {{ form.password.errors|striptags }} +

+ {% endif %} +
+
+ + {% if form.non_field_errors %} + {% for error in form.non_field_errors %} +
{{ error }}
+ {% endfor %} + {% endif %} + + + +
+ +
+ + +{% endblock %} diff --git a/idhub/templates/auth/login_base.html b/idhub/templates/auth/login_base.html new file mode 100644 index 0000000..c7c5db1 --- /dev/null +++ b/idhub/templates/auth/login_base.html @@ -0,0 +1,114 @@ +{% load i18n static %} + + + + + {% block head %} + {% block meta %} + + + + + + {% endblock %} + {% block title %}{% if title %}{{ title }} – {% endif %}IdHub{% endblock %} + + + {% block style %} + + + + + + + + + + {% endblock %} + {% endblock %} + + + + +
+
+
+ {% block messages %} + {% for message in messages %} + + {% endfor %} + {% endblock messages %} + +
+
+
+
+ {% block branding %} +

+ Pangea.org - Internet etic i solidari +

+ {% endblock %} +
+
+ {% block login_content %} + {% endblock %} +
+
+ +
+
+ + + + +
+
+
+ + + + + + + diff --git a/idhub/templates/auth/password_reset.html b/idhub/templates/auth/password_reset.html new file mode 100644 index 0000000..5555c06 --- /dev/null +++ b/idhub/templates/auth/password_reset.html @@ -0,0 +1,27 @@ +{% extends "auth/login_base.html" %} +{% load i18n django_bootstrap5 %} + +{% block login_content %} + +
+
+

{% trans 'Password reset' %}

+ {% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %} +
+
+ +
+
+
+
+ {% csrf_token %} + {% bootstrap_form form %} + {% bootstrap_form_errors form type='non_fields' %} +
+ +
+
+
+
+
+{% endblock %} diff --git a/idhub/templates/auth/password_reset_complete.html b/idhub/templates/auth/password_reset_complete.html new file mode 100644 index 0000000..51ad149 --- /dev/null +++ b/idhub/templates/auth/password_reset_complete.html @@ -0,0 +1,16 @@ +{% extends "auth/login_base.html" %} +{% load i18n %} + +{% block login_content %} +
+
+
+
+

{% trans 'Password reset complete' %}

+

{% trans 'Your password has been set. You may go ahead and log in now.' %}

+ {% trans 'Login' %} +
+
+
+
+{% endblock %} diff --git a/idhub/templates/auth/password_reset_confirm.html b/idhub/templates/auth/password_reset_confirm.html new file mode 100644 index 0000000..30b103e --- /dev/null +++ b/idhub/templates/auth/password_reset_confirm.html @@ -0,0 +1,36 @@ +{% extends "auth/login_base.html" %} +{% load i18n django_bootstrap5 %} + +{% block login_content %} +
+
+ {% if validlink %} +
+

{% trans 'Enter new password' %}

+

{% trans 'Please enter your new password twice so we can verify you typed it in correctly.' %}

+
+ +
+
+
+
+ {% csrf_token %} + {% bootstrap_form form %} + {% bootstrap_form_errors form type='non_fields' %} +
+ +
+
+
+
+
+ {% else %} +
+

{% trans 'Password reset unsuccessful' %}

+

{% trans 'The password reset link was invalid, possibly because it has already been used.' %}
+ {% trans 'Please request a new password reset.' %}

+
+ {% endif %} +
+
+{% endblock %} diff --git a/idhub/templates/auth/password_reset_done.html b/idhub/templates/auth/password_reset_done.html new file mode 100644 index 0000000..1b18de7 --- /dev/null +++ b/idhub/templates/auth/password_reset_done.html @@ -0,0 +1,15 @@ +{% extends "auth/login_base.html" %} +{% load i18n %} + +{% block login_content %} +
+
+

{% trans 'Password reset sent' %}

+ +

{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}

+ +

{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}

+ +
+
+{% endblock %} diff --git a/idhub/templates/idhub/admin/registration/activate_user_email.html b/idhub/templates/idhub/admin/registration/activate_user_email.html new file mode 100644 index 0000000..54370b8 --- /dev/null +++ b/idhub/templates/idhub/admin/registration/activate_user_email.html @@ -0,0 +1,31 @@ +{% load i18n %}{% autoescape off %} +{% trans "IdHub" as site %} +

+ {% blocktrans %}You're receiving this email because your user account at {{site}} has been activated.{% endblocktrans %} +

+ +

+{% trans "Your username is:" %} {{ user.username }} +

+ +

+{% trans "Please go to the following page and choose a password:" %} +

+ +

+{% block reset_link %} + +{{ protocol }}://{{ domain }}{% url 'idhub:password_reset_confirm' uidb64=uid token=token %} + +{% endblock %} +

+ +

+{% trans "Thanks for using our site!" %} +

+ +

+{% blocktrans %}The {{site}} team{% endblocktrans %} +

+ +{% endautoescape %} diff --git a/idhub/templates/idhub/admin/registration/activate_user_email.txt b/idhub/templates/idhub/admin/registration/activate_user_email.txt new file mode 100644 index 0000000..e3204b1 --- /dev/null +++ b/idhub/templates/idhub/admin/registration/activate_user_email.txt @@ -0,0 +1,19 @@ +{% load i18n %}{% autoescape off %} + +{% trans "Idhub" as site %} + +{% blocktrans %}You're receiving this email because your user account at {{site}} has been activated.{% endblocktrans %} + +{% trans "Your username is:" %} {{ user.username }} + +{% trans "Please go to the following page and choose a password:" %} +{% block reset_link %} +{{ protocol }}://{{ domain }}{% url 'idhub:password_reset_confirm' uidb64=uid token=token %} +{% endblock %} + + +{% trans "Thanks for using our site!" %} + +{% blocktrans %}The {{site}} team{% endblocktrans %} + +{% endautoescape %} diff --git a/idhub/templates/idhub/admin/registration/activate_user_subject.txt b/idhub/templates/idhub/admin/registration/activate_user_subject.txt new file mode 100644 index 0000000..d28a515 --- /dev/null +++ b/idhub/templates/idhub/admin/registration/activate_user_subject.txt @@ -0,0 +1,4 @@ +{% load i18n %}{% autoescape off %} +{% trans "IdHub" as site %} +{% blocktrans %}User activation on {{site}}{% endblocktrans %} +{% endautoescape %} diff --git a/idhub/templates/idhub/admin/registration/password_reset_email.html b/idhub/templates/idhub/admin/registration/password_reset_email.html new file mode 100644 index 0000000..062025a --- /dev/null +++ b/idhub/templates/idhub/admin/registration/password_reset_email.html @@ -0,0 +1,30 @@ +{% load i18n %}{% autoescape off %} +

+{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} +

+ +

+{% trans "Please go to the following page and choose a new password:" %} +

+ +

+{% block reset_link %} + +{{ protocol }}://{{ domain }}{% url 'idhub:password_reset_confirm' uidb64=uid token=token %} + +{% endblock %} +

+ +

+{% trans "Your username, in case you've forgotten:" %} {{ user.username }} +

+ +

+{% trans "Thanks for using our site!" %} +

+ +

+{% blocktrans %}The {{ site_name }} team{% endblocktrans %} +

+ +{% endautoescape %} diff --git a/idhub/templates/idhub/admin/registration/password_reset_email.txt b/idhub/templates/idhub/admin/registration/password_reset_email.txt new file mode 100644 index 0000000..a4313fe --- /dev/null +++ b/idhub/templates/idhub/admin/registration/password_reset_email.txt @@ -0,0 +1,14 @@ +{% load i18n %}{% autoescape off %} +{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} + +{% trans "Please go to the following page and choose a new password:" %} +{% block reset_link %} +{{ protocol }}://{{ domain }}{% url 'idhub:password_reset_confirm' uidb64=uid token=token %} +{% endblock %} +{% trans "Your username, in case you've forgotten:" %} {{ user.username }} + +{% trans "Thanks for using our site!" %} + +{% blocktrans %}The {{ site_name }} team{% endblocktrans %} + +{% endautoescape %} diff --git a/idhub/templates/idhub/admin/registration/password_reset_subject.txt b/idhub/templates/idhub/admin/registration/password_reset_subject.txt new file mode 100644 index 0000000..45a354b --- /dev/null +++ b/idhub/templates/idhub/admin/registration/password_reset_subject.txt @@ -0,0 +1,3 @@ +{% load i18n %}{% autoescape off %} +{% blocktrans %}Password reset on {{ site_name }}{% endblocktrans %} +{% endautoescape %} \ No newline at end of file diff --git a/idhub/urls.py b/idhub/urls.py index 02f7625..61e8e99 100644 --- a/idhub/urls.py +++ b/idhub/urls.py @@ -28,6 +28,35 @@ urlpatterns = [ permanent=False)), path('login/', LoginView.as_view(), name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), + path('auth/password_reset/', + auth_views.PasswordResetView.as_view( + template_name='auth/password_reset.html', + email_template_name='auth/registration/password_reset_email.txt', + html_email_template_name='auth/registration/password_reset_email.html', + subject_template_name='auth/registration/password_reset_subject.txt', + success_url=reverse_lazy('auth:password_reset_done') + ), + name='password_reset' + ), + path('auth/password_reset/done/', + auth_views.PasswordResetDoneView.as_view( + template_name='auth/password_reset_done.html' + ), + name='password_reset_done' + ), + path('auth/reset///', + auth_views.PasswordResetConfirmView.as_view( + template_name='auth/password_reset_confirm.html', + success_url=reverse_lazy('idhub:password_reset_complete') + ), + name='password_reset_confirm' + ), + path('auth/reset/done/', + auth_views.PasswordResetCompleteView.as_view( + template_name='auth/password_reset_complete.html' + ), + name='password_reset_complete' + ), # User path('user/dashboard/', views_user.UserDashboardView.as_view(), diff --git a/trustchain_idhub/settings.py b/trustchain_idhub/settings.py index c0af4ff..731b03f 100644 --- a/trustchain_idhub/settings.py +++ b/trustchain_idhub/settings.py @@ -30,6 +30,7 @@ SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', default=False, cast=bool) +DEVELOPMENT = config('DEVELOPMENT', default=False, cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv()) @@ -173,3 +174,4 @@ MESSAGE_TAGS = { messages.WARNING: 'alert-warning', messages.ERROR: 'alert-danger', } + From c539e85fd2cd01a9fb7521e985863889e355f632 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 19 Oct 2023 10:29:12 +0200 Subject: [PATCH 2/4] add roles info in user roles page --- idhub/templates/idhub/user/roles.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/idhub/templates/idhub/user/roles.html b/idhub/templates/idhub/user/roles.html index d6520a0..e439a01 100644 --- a/idhub/templates/idhub/user/roles.html +++ b/idhub/templates/idhub/user/roles.html @@ -2,4 +2,30 @@ {% load i18n %} {% block content %} +
+
+
+ + + + + + + + + + {% for rol in user.roles.all %} + + + + + + {% endfor %} + +
{{ rol.service.rol.name }}{{ rol.service.description }}{{ rol.service.domain }}
+
+
+
+ + {% endblock %} From 88675bc8079ecc8b5f1a6ca8de71f9ae391c40f4 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 19 Oct 2023 13:11:15 +0200 Subject: [PATCH 3/4] fix reset password --- .../admin/registration => auth}/password_reset_email.html | 0 .../admin/registration => auth}/password_reset_email.txt | 0 .../registration => auth}/password_reset_subject.txt | 0 idhub/urls.py | 8 ++++---- 4 files changed, 4 insertions(+), 4 deletions(-) rename idhub/templates/{idhub/admin/registration => auth}/password_reset_email.html (100%) rename idhub/templates/{idhub/admin/registration => auth}/password_reset_email.txt (100%) rename idhub/templates/{idhub/admin/registration => auth}/password_reset_subject.txt (100%) diff --git a/idhub/templates/idhub/admin/registration/password_reset_email.html b/idhub/templates/auth/password_reset_email.html similarity index 100% rename from idhub/templates/idhub/admin/registration/password_reset_email.html rename to idhub/templates/auth/password_reset_email.html diff --git a/idhub/templates/idhub/admin/registration/password_reset_email.txt b/idhub/templates/auth/password_reset_email.txt similarity index 100% rename from idhub/templates/idhub/admin/registration/password_reset_email.txt rename to idhub/templates/auth/password_reset_email.txt diff --git a/idhub/templates/idhub/admin/registration/password_reset_subject.txt b/idhub/templates/auth/password_reset_subject.txt similarity index 100% rename from idhub/templates/idhub/admin/registration/password_reset_subject.txt rename to idhub/templates/auth/password_reset_subject.txt diff --git a/idhub/urls.py b/idhub/urls.py index 61e8e99..6254243 100644 --- a/idhub/urls.py +++ b/idhub/urls.py @@ -31,10 +31,10 @@ urlpatterns = [ path('auth/password_reset/', auth_views.PasswordResetView.as_view( template_name='auth/password_reset.html', - email_template_name='auth/registration/password_reset_email.txt', - html_email_template_name='auth/registration/password_reset_email.html', - subject_template_name='auth/registration/password_reset_subject.txt', - success_url=reverse_lazy('auth:password_reset_done') + email_template_name='auth/password_reset_email.txt', + html_email_template_name='auth/password_reset_email.html', + subject_template_name='auth/password_reset_subject.txt', + success_url=reverse_lazy('idhub:password_reset_done') ), name='password_reset' ), From acad550dd0fa6b289ee7517c6944a5dd88fd00c9 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 19 Oct 2023 15:20:06 +0200 Subject: [PATCH 4/4] add multiselect for roles in services --- idhub/admin/forms.py | 2 ++ .../0005_remove_service_rol_service_rol.py | 21 +++++++++++++++++++ idhub/models.py | 7 ++++--- idhub/templates/idhub/admin/people.html | 2 +- idhub/templates/idhub/admin/services.html | 2 +- idhub/templates/idhub/admin/user.html | 2 +- idhub/templates/idhub/admin/user_edit.html | 2 +- 7 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 idhub/migrations/0005_remove_service_rol_service_rol.py diff --git a/idhub/admin/forms.py b/idhub/admin/forms.py index 74046df..fc66f14 100644 --- a/idhub/admin/forms.py +++ b/idhub/admin/forms.py @@ -1,5 +1,6 @@ from django import forms from django.contrib.auth.models import User +from idhub.models import Rol class ProfileForm(forms.ModelForm): @@ -21,5 +22,6 @@ class RolForm(forms.ModelForm): class ServiceForm(forms.ModelForm): MANDATORY_FIELDS = ['domain', 'rol'] + class UserRolForm(forms.ModelForm): MANDATORY_FIELDS = ['service'] diff --git a/idhub/migrations/0005_remove_service_rol_service_rol.py b/idhub/migrations/0005_remove_service_rol_service_rol.py new file mode 100644 index 0000000..a383ca4 --- /dev/null +++ b/idhub/migrations/0005_remove_service_rol_service_rol.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.5 on 2023-10-19 13:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("idhub", "0004_userrol"), + ] + + operations = [ + migrations.RemoveField( + model_name="service", + name="rol", + ), + migrations.AddField( + model_name="service", + name="rol", + field=models.ManyToManyField(to="idhub.rol"), + ), + ] diff --git a/idhub/models.py b/idhub/models.py index 6c143b7..3c187b3 100644 --- a/idhub/models.py +++ b/idhub/models.py @@ -92,12 +92,13 @@ class Rol(models.Model): class Service(models.Model): domain = models.CharField(max_length=250) description = models.CharField(max_length=250) - rol = models.ForeignKey( + rol = models.ManyToManyField( Rol, - on_delete=models.CASCADE, - related_name='services', ) + def get_roles(self): + return ", ".join([x.name for x in self.rol.all()]) + def __str__(self): return "{} -> {}".format(self.domain, self.rol.name) diff --git a/idhub/templates/idhub/admin/people.html b/idhub/templates/idhub/admin/people.html index 69cd758..ff19975 100644 --- a/idhub/templates/idhub/admin/people.html +++ b/idhub/templates/idhub/admin/people.html @@ -31,7 +31,7 @@ {% for r in user.roles.all %} - {{ r.service.rol.name }} + {{ r.service.get_roles }} {% endfor %} {% trans 'View' %} diff --git a/idhub/templates/idhub/admin/services.html b/idhub/templates/idhub/admin/services.html index 11f7c0b..92fe5b1 100644 --- a/idhub/templates/idhub/admin/services.html +++ b/idhub/templates/idhub/admin/services.html @@ -24,7 +24,7 @@ {{ service.domain }} {{ service.description }} - {{ service.rol.name }} + {{ service.get_roles }} diff --git a/idhub/templates/idhub/admin/user.html b/idhub/templates/idhub/admin/user.html index 30a0041..3bee80f 100644 --- a/idhub/templates/idhub/admin/user.html +++ b/idhub/templates/idhub/admin/user.html @@ -92,7 +92,7 @@ {% for rol in object.roles.all %} - {{ rol.service.rol.name }} + {{ rol.service.get_roles }} {{ rol.service.description }} {{ rol.service.domain }} diff --git a/idhub/templates/idhub/admin/user_edit.html b/idhub/templates/idhub/admin/user_edit.html index 4752a3b..e162723 100644 --- a/idhub/templates/idhub/admin/user_edit.html +++ b/idhub/templates/idhub/admin/user_edit.html @@ -80,7 +80,7 @@ {% for rol in object.roles.all %} - {{ rol.service.rol.name }} + {{ rol.service.get_roles }} {{ rol.service.description }} {{ rol.service.domain }}