fix: added logout option

This commit is contained in:
iritmaximus
2023-02-20 17:44:05 +02:00
parent e13b5a072f
commit eea88d2c29
2 changed files with 20 additions and 4 deletions
+13 -3
View File
@@ -1,6 +1,16 @@
<title>Main page</title>
<h1>Home</h1>
<p><a href="/games">Go to games</a></p>
<p><a href="/courses">Go to courses</a></p>
<p><a href="/times">Go to times</a></p>
<div>
<p>Logged in as {{session["name"]}}</p>
<p><a href="/logout">Logout</a></p>
</div>
<div>
<ul>
<li><a href="/games">Go to games</a></li>
<li><a href="/courses">Go to courses</a></li>
<li><a href="/times">Go to times</a></li>
</ul>
</div>
+7 -1
View File
@@ -1,4 +1,4 @@
from flask import render_template, request, redirect, url_for
from flask import render_template, request, redirect, url_for, session
from flaskr import app
from flaskr.database import test_db, create_db, reset_db
@@ -60,6 +60,12 @@ def login():
return "Incorrect http method"
@app.route("/logout")
def logout():
session["name"] = None
return redirect(url_for("login"))
@app.route("/signup", methods=["GET", "POST"])
def signup():
if request.method == "GET":