Browse Source

devel..

main
david 8 years ago
parent
commit
3e84c65282
  1. 11
      app.py
  2. 4
      templates/login.html

11
app.py

@ -14,11 +14,14 @@ def index():
@app.route("/login", methods = ["GET", "POST"])
def login():
if request.method == "POST":
session["username"] = request.form["username"]
if 'login' in request.referrer:
return redirect(url_for('index'))
if request.form["password"] == "tool":
session["username"] = request.form["username"]
if 'login' in request.referrer:
return redirect(url_for('index'))
else:
return redirect(request.referrer)
else:
return redirect(request.referrer)
return 'Error: Wrong username or password! <a href="login">login</a>'
return render_template("login.html")
@app.route("/logout")

4
templates/login.html

@ -4,8 +4,8 @@
<h1>Login</h1>
<b>Please login:</b><br><br>
<form method="post" action="login">
username: <input type="text" name="username"><br>
password: <input type="password" name="password"><br>
<input type="text" name="username" value="username"><br>
<input type="password" name="password" value="password"><br>
<input type="submit" value="login">
</form>
{% endblock %}