feat: add home und login function

This commit is contained in:
robin committed 2026-10-31 20:16:34 +01:00
1 parent 535405cf99
commit 92807e857a
6 files changed
+200 -22

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
from flask import Blueprint, render_template, request, redirect, url_for, session
bp = Blueprint("main", __name__)
@bp.route("/login")
def login():
if "name" in session:
return redirect(url_for("main.index"))
return render_template("login.html")
@bp.route("/", methods=["GET", "POST"])
def index():
if request.method == "POST":
session["name"] = request.form["name"].strip()
if "name" not in session:
return redirect(url_for("main.login"))
return render_template("index.html")
@bp.route("/test")
def test():
if "name" not in session:
return redirect(url_for("main.index"))
return render_template("test.html", name=session["name"])