Add some layouting and navving
This commit is contained in:
parent
146f81b0fe
commit
688f303978
4 changed files with 171 additions and 52 deletions
|
@ -27,7 +27,7 @@ def register_callback(req: HttpRequest):
|
||||||
code = req.GET['code']
|
code = req.GET['code']
|
||||||
csrftoken = req.COOKIES.get('csrftoken')
|
csrftoken = req.COOKIES.get('csrftoken')
|
||||||
print(csrftoken)
|
print(csrftoken)
|
||||||
response = requests.post(settings.OAUTH["AUTHORIZE_URI"],
|
response = requests.post(settings.OAUTH["ACCESS_TOKEN_URI"],
|
||||||
data={'code': code,
|
data={'code': code,
|
||||||
'grant_type': 'authorization_code',
|
'grant_type': 'authorization_code',
|
||||||
'client_id': settings.OAUTH["CLIENT_ID"],
|
'client_id': settings.OAUTH["CLIENT_ID"],
|
||||||
|
@ -51,7 +51,7 @@ def register_callback(req: HttpRequest):
|
||||||
redirect('/')
|
redirect('/')
|
||||||
else:
|
else:
|
||||||
print(response.request)
|
print(response.request)
|
||||||
raise OAuthException(f'Status code not 200, response: {response}')
|
raise OAuthException(f'Status code not 200, response: {response}: {response.text}')
|
||||||
except OAuthException as e:
|
except OAuthException as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,128 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width"/>
|
<meta name="viewport" content="width=device-width"/>
|
||||||
<title>Zeus WPI Kelderregistratiesysteem™</title>
|
<title>{% block title %}Zeus WPI Kelderregistratiesysteem™{% endblock %}</title>
|
||||||
</head>
|
{% block styles %}{% endblock %}
|
||||||
<body>
|
<style>
|
||||||
<h1>Zeus WPI Kelderregistratiesysteem™</h1>
|
nav {
|
||||||
{% block content %}{% endblock %}
|
width: 100vw;
|
||||||
</body>
|
background-color: #ff8000;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
/*this option by default dispose the elements in a row (flex-direction: row)*/
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
nav li {
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 0 2vw;
|
||||||
|
/* our font-size will be 3% of the height of the viewport */
|
||||||
|
font-size: 3vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a {
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
/*below I changed the color*/
|
||||||
|
color: black;
|
||||||
|
/*I added some padding*/
|
||||||
|
padding: 2vw;
|
||||||
|
/*also changed the font family but that's totally irrelevant*/
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a:hover {
|
||||||
|
background-color: rgba(255, 128, 0, 0.53);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*change the layout of the navigation bar for all the screens
|
||||||
|
that have a width less or equal than 500px*/
|
||||||
|
|
||||||
|
@media only screen and (max-width: 750px) {
|
||||||
|
/*shows elements in a column*/
|
||||||
|
ul {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* deletes margin on top or bottom of the a tag*/
|
||||||
|
li {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* makes sure that the a tag will take the entire screen*/
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
/*makes the button visible*/
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
/*since we are here, we can style it a little bit!*/
|
||||||
|
padding: 2vw;
|
||||||
|
font-size: 3vh;
|
||||||
|
background-color: #AFE0FF;
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
/*outline none removes the default blue border that appears anytime you click on the button*/
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
/*this put the button on the left*/
|
||||||
|
align-self: flex-start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<button id="nav-button">🞬</button>
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'events:index' %}">
|
||||||
|
Home</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'users:profile' %}">
|
||||||
|
Profile
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<h1>Zeus WPI Kelderregistratiesysteem™</h1>
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
let button = document.getElementById('nav-button')
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
if (button.innerText === "☰") {
|
||||||
|
button.innerText = "✖";
|
||||||
|
} else {
|
||||||
|
button.innerText = "☰";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!DOCTYPE html>
|
{% extends "base.html" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}KeRS - Profile{% endblock %}
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Profile</title>
|
{% block styles %}
|
||||||
</head>
|
<style>
|
||||||
<body>
|
|
||||||
<style>
|
|
||||||
.container {
|
.container {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
@ -22,9 +20,12 @@
|
||||||
margin: 8px 0;
|
margin: 8px 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="container">
|
{% endblock %}
|
||||||
<h1>Profile</h1>
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<h1>Profile</h1>
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<p>Username: {{ username }}</p>
|
<p>Username: {{ username }}</p>
|
||||||
<label>Student number</label>
|
<label>Student number</label>
|
||||||
|
@ -37,6 +38,6 @@
|
||||||
<p>Not logged in</p>
|
<p>Not logged in</p>
|
||||||
<a href="/login/zeus/register">Login</a>
|
<a href="/login/zeus/register">Login</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
|
@ -2,7 +2,9 @@ from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
app_name = "users"
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('profile', views.profile),
|
path('profile', views.profile, name="profile"),
|
||||||
path('logout', views.logout_view)
|
path('logout', views.logout_view)
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue