+ {% with provider.get_active_identity as identity %}
{% if provider.icon %}

{% else %}
{% endif %}
- {% if provider.profile %}
-
{{provider.label}}
+ {% if identity.profile %}
+
{{provider.label}}
{% else %}
{{provider.label}}
{% endif %}
- {% if provider.username %}
- ({{provider.username}})
+ {% if identity.username %}
+ ({{identity.username}})
{% endif %}
+ {% endwith %}
{% if provider.get_active_identity %}
@@ -81,52 +83,8 @@
{% endif %}
{% if identities %}
-
Identity audit logs
-{% for identity in identities %}
-
-
-
-
-
- | {% trans "Date" %} |
- {% trans "Author" %} |
- {% trans "Notes" %} |
- {% trans "Changes" %} |
-
-
-
- {% for e in identity.audit_log.all %}
-
- | {{e.logdate|date:"Y-m-d H:i:s"}} |
- {{e.author}} |
- {{e.notes}} |
-
-
- {% for field, old, new in e.get_changes_list %}
- - {{field}}: {{old}} → {{new}}
- {% endfor %}
-
- |
-
- {% empty %}
- | {% trans "No audit log for this identity" %} |
- {% endfor %}
-
-
-
-{% endfor %}
+
{% trans "Identity audit logs" %}
+{% include "signon/audit_identities.html" with identities=identities only %}
{% endif %}
{% endblock %}
diff --git a/signon/urls.py b/signon/urls.py
index 21b919aa2631688ccd2826e38506a5dbb5439c7a..065b4b053bd7862b1807eee330afeee389b8c427 100644
--- a/signon/urls.py
+++ b/signon/urls.py
@@ -3,6 +3,8 @@ from . import views
urlpatterns = [
path('login/', views.Login.as_view(), name='signon_login'),
+ path('identities/', views.Identities.as_view(), name='signon_identities'),
+ path('identities/
/', views.Identities.as_view(), name='signon_identities_person'),
path('logout/', views.Logout.as_view(), name='signon_logout'),
path('oidc/callback//', views.OIDCAuthenticationCallbackView.as_view(), name='signon_oidc_callback'),
]
diff --git a/signon/views.py b/signon/views.py
index 68c61ca0efeb1fd2c77a6ef6cb7dd510a4bc444c..8f20912170d49620d6074b572449ac52313de5f0 100644
--- a/signon/views.py
+++ b/signon/views.py
@@ -4,7 +4,7 @@ from django.views.generic import View, TemplateView
from django import http
from django.shortcuts import redirect
from django.contrib import auth
-from backend.mixins import VisitorMixin
+from backend.mixins import VisitorMixin, VisitPersonMixin
from backend.models import Person
from .models import Identity
from . import providers
@@ -45,6 +45,16 @@ class Logout(View):
return redirect("home")
+class Identities(VisitPersonMixin, TemplateView):
+ template_name = "signon/identities.html"
+ require_visit_perms = "view_person_audit_log"
+
+ def get_context_data(self, **kw):
+ ctx = super().get_context_data(**kw)
+ ctx["identities"] = self.person.identities.all()
+ return ctx
+
+
class OIDCAuthenticationCallbackView(View):
def get(self, request, *args, **kw):
name = self.kwargs["name"]