login thingy
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 749 B |
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
{% extends "Base.html" %}
|
||||
|
||||
{% block main-content %}
|
||||
{% if user.is_authenticated %}
|
||||
<p>Current user: {{ user.email }}</p>
|
||||
<form action="{% url 'oidc_logout' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="logout">
|
||||
</form>
|
||||
{% else %}
|
||||
<a href="{% url 'oidc_authentication_init' %}">Login</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% 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">
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="logout">
|
||||
</form>
|
||||
{% else %}
|
||||
<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 %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+6
-2
@@ -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,7 +13,11 @@ spt = spotify.Spotify()
|
||||
|
||||
class AuthView(View):
|
||||
def get(self, request):
|
||||
return TemplateResponse(request, "Login.html", {})
|
||||
if request.user.is_authenticated:
|
||||
#return TemplateResponse(request, "Nominate.html", {})
|
||||
return HttpResponseRedirect('/vote')
|
||||
else:
|
||||
return TemplateResponse(request, "Login.html", {})
|
||||
|
||||
class VoteView(LoginRequiredMixin, View):
|
||||
def get(self, request, error=None):
|
||||
|
||||
Reference in New Issue
Block a user