WebAdminPanel/apps/auth.py

24 lines
600 B
Python

from flask import Blueprint,render_template,request,redirect,url_for
from werkzeug.security import check_password_hash
auth = Blueprint('auth',__name__)
@auth.route("/")
@auth.route("/login",methods=["GET"])
def login_template():
return render_template("login.html")
@auth.route("/login",methods=["POST"])
def login():
username = request.form.get("username")
password = request.form.get("password")
# TODO: check hash password in database
return "Some operations"
@auth.route("/logout")
def logout():
# Logout from account
return redirect(url_for("auth.login"))