This commit is contained in:
Michał Gdula 2023-05-29 10:41:53 +00:00
parent b30e336ae6
commit d9714da918
4 changed files with 14 additions and 10 deletions

View file

@ -56,7 +56,7 @@ def create_app(): # pylint: disable=R0914
print(
"""
####################################################
# DEFAULY ADMIN USER GENERATED WITH GIVEN USERNAME #
# DEFAULT ADMIN USER GENERATED WITH GIVEN USERNAME #
# THE DEFAULT PASSWORD "changeme!" HAS BEEN USED, #
# PLEASE UPDATE IT IN THE SETTINGS! #
####################################################
@ -76,18 +76,18 @@ def create_app(): # pylint: disable=R0914
login_manager.login_view = "onlylegs.index"
@login_manager.user_loader
def load_user(user_id): # skipcq: PTC-W0065
def load_user(user_id):
return User.query.filter_by(alt_id=user_id).first()
@login_manager.unauthorized_handler
def unauthorized(): # skipcq: PTC-W0065
def unauthorized():
error = 401
msg = "You are not authorized to view this page!!!!"
return render_template("error.html", error=error, msg=msg), error
# ERROR HANDLERS
@app.errorhandler(Exception)
def error_page(err): # skipcq: PTC-W0065
def error_page(err):
"""
Error handlers, if the error is not a HTTP error, return 500
"""