mirror of
https://github.com/tjsga/studyguides.git
synced 2025-04-05 11:50:16 -04:00
add logout button
This commit is contained in:
parent
1087d7e2cd
commit
4bde0cce90
|
@ -7,5 +7,6 @@ app_name = "auth"
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", views.index, name="index"),
|
path("", views.index, name="index"),
|
||||||
path("login/", views.login, name="login"),
|
path("login/", views.login, name="login"),
|
||||||
|
path("logout/", views.logout_view, name="logout"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from django.contrib.auth import logout
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
|
@ -8,3 +9,7 @@ def index(request):
|
||||||
|
|
||||||
def login(request):
|
def login(request):
|
||||||
return render(request, "login.html")
|
return render(request, "login.html")
|
||||||
|
|
||||||
|
def logout_view(request):
|
||||||
|
logout(request)
|
||||||
|
return redirect("auth:login")
|
||||||
|
|
|
@ -145,6 +145,7 @@ USE_TZ = True
|
||||||
|
|
||||||
LOGIN_URL = "auth:login"
|
LOGIN_URL = "auth:login"
|
||||||
LOGIN_REDIRECT_URL = "auth:index"
|
LOGIN_REDIRECT_URL = "auth:index"
|
||||||
|
LOGOUT_REDIRECT_URL = "auth:login"
|
||||||
|
|
||||||
SESSION_SAVE_EVERY_REQUEST = True
|
SESSION_SAVE_EVERY_REQUEST = True
|
||||||
|
|
||||||
|
|
|
@ -45,14 +45,20 @@
|
||||||
</div>
|
</div>
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
<div class="size-5 my-2 josefin-sans text-center">
|
{% if user.is_authenticated %}
|
||||||
{% if user.is_teacher %}
|
<div class="size-5 my-2 josefin-sans text-center">
|
||||||
<a style="padding:20px;" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSddHARB7zIgCBN-swWkejx6f4wJNslxh5AnkS65BzJ2pt7uLQ/viewform?usp=sf_link">Report a Study Guide</a>
|
{% if user.is_teacher %}
|
||||||
{% elif user.is_superuser or user.is_staff %}
|
<a style="padding:20px;" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSddHARB7zIgCBN-swWkejx6f4wJNslxh5AnkS65BzJ2pt7uLQ/viewform?usp=sf_link">Report a Study Guide</a>
|
||||||
<a style="padding:20px;" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSddHARB7zIgCBN-swWkejx6f4wJNslxh5AnkS65BzJ2pt7uLQ/viewform?usp=sf_link">Report a Study Guide</a>
|
{% elif user.is_superuser or user.is_staff %}
|
||||||
<a style="padding:20px;" href="/admin">Access Admin Console</a>
|
<a style="padding:20px;" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSddHARB7zIgCBN-swWkejx6f4wJNslxh5AnkS65BzJ2pt7uLQ/viewform?usp=sf_link">Report a Study Guide</a>
|
||||||
{% endif %}
|
<a style="padding:20px;" href="/admin">Access Admin Console</a>
|
||||||
<a style="padding:20px;" target="_blank" href="https://docs.google.com/forms/d/1p7DvGQfJM8nG88fC7eQ4lWcdEOKjNixUtFoJ8zpq_Co/viewform?edit_requested=true">Add Study Guide</a>
|
{% endif %}
|
||||||
</div>
|
<a style="padding:20px;" target="_blank" href="https://docs.google.com/forms/d/1p7DvGQfJM8nG88fC7eQ4lWcdEOKjNixUtFoJ8zpq_Co/viewform?edit_requested=true">Add Study Guide</a>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="size-5 my-2 josefin-sans text-center">
|
||||||
|
<a href="{% url 'auth:logout' %}">Logout</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user