login thingy

This commit is contained in:
2024-02-20 17:52:52 +01:00
parent fdbdebca2a
commit 2eeb8eee10
5 changed files with 52 additions and 18 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

+10
View File
@@ -38,6 +38,11 @@ body {
min-width: 300px;
}
.window.popup.login {
width: 380px;
left: calc(50% - 190px);
}
.window.popup .window-body {
display: flex;
flex-flow: row nowrap;
@@ -58,6 +63,11 @@ body {
background-image: url('img/check.png');
}
.window.popup .window-body .icon.login {
background-image: url('img/login.png');
background-attachment:unset;
}
.window.popup .window-body .icon.error {
background-image: url('img/error.png');
}
-3
View File
@@ -25,9 +25,6 @@
<li role="tab" {% if request.path == '/track/' %}aria-selected="true" {% endif %}>
<a href="{% url 'nominate' %}">Nomineren</a>
</li>
<li role="tab" {% if request.path == '/' %}aria-selected="true" {% endif %}>
<a href="/">Statistieken</a>
</li>
</menu>
<div class="window" role="tabpanel">
<div class="window-body">
+28 -5
View File
@@ -1,6 +1,20 @@
{% extends "Base.html" %}
{% block main-content %}
{% load static %}
<html>
<head>
{% include "head.html" %}
</head>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<div class="window popup login" id="info-window">
<div class="title-bar">
<div class="title-bar-text">Welkom bij Muzak</div>
<div class="title-bar-controls">
<button aria-label="Close" onclick="hidePopup()"></button>
</div>
</div>
<div class="window-body">
<div class="icon login"></div>
<div class="text">
<div>
{% if user.is_authenticated %}
<p>Current user: {{ user.email }}</p>
<form action="{% url 'oidc_logout' %}" method="post">
@@ -8,6 +22,15 @@
<input type="submit" value="logout">
</form>
{% else %}
<a href="{% url 'oidc_authentication_init' %}">Login</a>
<p>Gebruik onderstaande knop om in te loggen.</p>
<p>Als je geen inloggegevens hebt, meld je dan bij de beheerder van deze site.</p>
<form action="{% url 'oidc_authentication_init' %}" method="get">
<input type="submit" value="Login">
</form>
{% endif %}
{% endblock %}
</div>
</div>
</div>
</div>
</body>
</html>
+5 -1
View File
@@ -1,6 +1,6 @@
from django.shortcuts import render
from django.views import View
from django.http import HttpResponse
from django.http import HttpResponse, HttpResponseRedirect
from django.template.response import TemplateResponse
from django.contrib.auth.mixins import LoginRequiredMixin
import re
@@ -13,6 +13,10 @@ spt = spotify.Spotify()
class AuthView(View):
def get(self, request):
if request.user.is_authenticated:
#return TemplateResponse(request, "Nominate.html", {})
return HttpResponseRedirect('/vote')
else:
return TemplateResponse(request, "Login.html", {})
class VoteView(LoginRequiredMixin, View):