Skip to content

Commit

Permalink
WIP: Use OIDC for admin login
Browse files Browse the repository at this point in the history
  • Loading branch information
timonegk committed Feb 26, 2024
1 parent 6dcd80c commit a8da9ff
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 126 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
Django = "~=4.1.12" # can be upgraded once we have postgres >11 deployed
Django = "~=5.0"
Pillow = "~=10.0"
PyPDF2 = "~=1.27"
bleach = {extras = ["css"], version = "~=6.1"}
Expand Down
244 changes: 122 additions & 122 deletions Pipfile.lock

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion locale/de_DE/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mafiasi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-12 16:48+0100\n"
"POT-Creation-Date: 2024-02-26 19:24+0100\n"
"PO-Revision-Date: 2024-01-12 16:56+0100\n"
"Last-Translator: Timon Engelke <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -88,6 +88,13 @@ msgstr "Probleme?"
msgid "License information"
msgstr "Lizenzinformationen"

#: mafiasi/base/templates/base/login.html:8
#, python-format
msgid ""
"You are authenticated as %(username)s, but are not authorized to access this "
"page. Would you like to login to a different account?"
msgstr ""

#: mafiasi/base/templates/base/problems.html:7
#, python-format
msgid ""
Expand Down
9 changes: 8 additions & 1 deletion locale/en_US/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mafiasi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-12 17:28+0100\n"
"POT-Creation-Date: 2024-02-26 19:24+0100\n"
"PO-Revision-Date: 2024-01-12 17:06+0100\n"
"Last-Translator: Timon Engelke <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -80,6 +80,13 @@ msgstr ""
msgid "License information"
msgstr ""

#: mafiasi/base/templates/base/login.html:8
#, python-format
msgid ""
"You are authenticated as %(username)s, but are not authorized to access this "
"page. Would you like to login to a different account?"
msgstr ""

#: mafiasi/base/templates/base/problems.html:7
#, python-format
msgid ""
Expand Down
9 changes: 8 additions & 1 deletion locale/fr_FR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mafiasi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-12 16:48+0100\n"
"POT-Creation-Date: 2024-02-26 19:24+0100\n"
"PO-Revision-Date: 2024-01-15 16:39+0100\n"
"Last-Translator: Timon Engelke <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -88,6 +88,13 @@ msgstr "Problèmes?"
msgid "License information"
msgstr "Informations sur la licence"

#: mafiasi/base/templates/base/login.html:8
#, python-format
msgid ""
"You are authenticated as %(username)s, but are not authorized to access this "
"page. Would you like to login to a different account?"
msgstr ""

#: mafiasi/base/templates/base/problems.html:7
#, python-format
msgid ""
Expand Down
1 change: 1 addition & 0 deletions mafiasi/base/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ class MafiasiAdmin(UserAdmin):

admin.site.register(Yeargroup)
admin.site.register(Mafiasi, MafiasiAdmin)
admin.site.login_template = "base/login.html"
22 changes: 22 additions & 0 deletions mafiasi/base/templates/base/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends "admin/login.html" %}
{% load i18n %}
{% block content %}
<div id="content-main">

{% if user.is_authenticated %}
<p class="errornote">
{% 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 %}
</p>
{% endif %}

<form id="login-form" method="get" action="{% url 'simple_openid_connect:login' %}">
<div class="submit-row">
<input type="submit" value="Log in with Mafiasi">
</div>
</form>

</div>
{% endblock %}

0 comments on commit a8da9ff

Please sign in to comment.