Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add login form for admin that uses OIDC #1

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"project_name": "",
"project_slug": "{{ cookiecutter.project_name | slugify(separator='_') }}",
"author": "Fachschaft Informatik der Universität Hamburg (Mafiasi-AG)",
"openid_scope": "openid"
"openid_scope": "openid",

"_copy_without_render": [
"src/{{ cookiecutter.project_slug }}/*/templates/*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
from . import models

admin.site.register(models.MafiasiUser, UserAdmin)
admin.site.login_template = 'core/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="{% translate 'Log in with Mafiasi' %}">
</div>
</form>
lilioid marked this conversation as resolved.
Show resolved Hide resolved

</div>
{% endblock %}