mirror of
https://github.com/iritmaximus/timetrials.git
synced 2026-10-12 19:13:48 +03:00
fix: added logout option
This commit is contained in:
@@ -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
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user