bozo-backend/login.py
2023-06-09 15:22:50 +02:00

18 lines
647 B
Python

import flask
import database
page = flask.Blueprint("login", __name__, template_folder="templates")
@page.route("/login", methods=['POST', 'GET'])
def show():
if (flask.session.get("email")):
return (flask.redirect("/panel"))
if (flask.request.method == 'GET'):
return (flask.render_template("login/login.html"))
email = flask.request.form['email']
password = flask.request.form['password']
if (database.database.account_test(email, password)):
return (flask.render_template("login/login.html", error = "Invalid credentials"))
flask.session["email"] = email;
return (flask.redirect("/panel"))