mirror of
https://github.com/tjsga/studyguides.git
synced 2025-04-05 03:40:16 -04:00
add logout button
This commit is contained in:
parent
1087d7e2cd
commit
4bde0cce90
|
@ -7,5 +7,6 @@ app_name = "auth"
|
|||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
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
|
||||
|
||||
def index(request):
|
||||
|
@ -8,3 +9,7 @@ def index(request):
|
|||
|
||||
def login(request):
|
||||
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_REDIRECT_URL = "auth:index"
|
||||
LOGOUT_REDIRECT_URL = "auth:login"
|
||||
|
||||
SESSION_SAVE_EVERY_REQUEST = True
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
</div>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
{% if user.is_authenticated %}
|
||||
<div class="size-5 my-2 josefin-sans text-center">
|
||||
{% if user.is_teacher %}
|
||||
<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>
|
||||
|
@ -54,5 +55,10 @@
|
|||
{% endif %}
|
||||
<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>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue
Block a user