From e35a5da500cd9cbfe208884f347039acda7f9284 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 26 May 2024 13:59:31 +1200 Subject: [PATCH] 401 error handler page #78 --- app/errors/handlers.py | 6 ++++++ app/templates/errors/401.html | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 app/templates/errors/401.html diff --git a/app/errors/handlers.py b/app/errors/handlers.py index eaa52bc1..6c798569 100644 --- a/app/errors/handlers.py +++ b/app/errors/handlers.py @@ -14,3 +14,9 @@ from app.errors import bp def internal_error(error): db.session.rollback() return render_template('errors/500.html'), 500 + + +@bp.app_errorhandler(401) +def internal_error(error): + db.session.rollback() + return render_template('errors/401.html'), 401 \ No newline at end of file diff --git a/app/templates/errors/401.html b/app/templates/errors/401.html new file mode 100644 index 00000000..115eb36d --- /dev/null +++ b/app/templates/errors/401.html @@ -0,0 +1,21 @@ +{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %} + {% extends 'themes/' + theme() + '/base.html' %} +{% else %} + {% extends "base.html" %} +{% endif %} %} + +{% block app_content %} +
{{ _('You cannot access this area.') }}
+ +