feat: add home und login function
This commit is contained in:
1 parent
535405cf99
commit
92807e857a
6 files changed
+200
-22
No files matched your search
@@ -1,23 +1,9 @@
|
||||
from flask import Flask, render_template, request, redirect, url_for, session
|
||||
from flask import Flask
|
||||
from routes import bp
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = "secret-key-ultra-pro-max-123"
|
||||
|
||||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
if request.method == "POST":
|
||||
session["name"] = request.form["name"].strip()
|
||||
return redirect(url_for("test"))
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
@app.route("/test")
|
||||
def test():
|
||||
if "name" not in session:
|
||||
return redirect(url_for("index"))
|
||||
return render_template("test.html", name=session["name"])
|
||||
|
||||
app.register_blueprint(bp)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
Reference in new issue
Block a user