From 4f71c4ad4579e1201c18ee0d8c38dbcaf02b2645 Mon Sep 17 00:00:00 2001 From: Timon Engelke Date: Tue, 13 Feb 2024 15:45:25 +0100 Subject: [PATCH] Add login form for admin that uses OIDC --- .../core/admin.py | 1 + .../core/templates/core/login.html | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 {{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/templates/core/login.html diff --git a/{{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/admin.py b/{{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/admin.py index 9e0c953..d96dc90 100644 --- a/{{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/admin.py +++ b/{{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/admin.py @@ -4,3 +4,4 @@ from . import models admin.site.register(models.MafiasiUser, UserAdmin) +admin.site.login_template = 'core/login.html' diff --git a/{{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/templates/core/login.html b/{{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/templates/core/login.html new file mode 100644 index 0000000..ff2edbc --- /dev/null +++ b/{{ cookiecutter.project_slug }}/src/{{ cookiecutter.project_slug }}/core/templates/core/login.html @@ -0,0 +1,22 @@ +{% extends "admin/login.html" %} +{% load i18n %} +{% block content %} +
+ +{% if user.is_authenticated %} +

+{% blocktranslate trimmed %} + You are authenticated as {{ username }}, but are not authorized to + access this page. Would you like to login to a different account? +{% endblocktranslate %} +

+{% endif %} + +
+
+ +
+
+ +
+{% endblock %}