flask-server/kinolist/login.py
2024-10-08 19:26:26 +02:00

21 lines
435 B
Python

import flask
from flask_login import (LoginManager, UserMixin)
class User(UserMixin):
def __init__(self, id):
super().__init__()
self.id = id
login_manager = LoginManager()
@login_manager.user_loader
def user_loader(id):
if id == "admin":
user = User(id)
return user
return
@login_manager.unauthorized_handler
def redirect():
return flask.redirect(flask.url_for("pages.login_page"))