From b5b167479f39deb86fcf098841f3688c8859459a Mon Sep 17 00:00:00 2001 From: Son Nguyen Kim Date: Fri, 10 May 2024 18:52:12 +0200 Subject: [PATCH] Fix admin loop (#2103) * mailbox page requires sudo * fix the loop when non-admin user visits an admin URL https://github.com/simple-login/app/issues/2101 --------- Co-authored-by: Son NK --- app/admin_model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/admin_model.py b/app/admin_model.py index 98844bde1..8cf0a5485 100644 --- a/app/admin_model.py +++ b/app/admin_model.py @@ -46,7 +46,8 @@ def is_accessible(self): def inaccessible_callback(self, name, **kwargs): # redirect to login page if user doesn't have access - return redirect(url_for("auth.login", next=request.url)) + flash("You don't have access to the admin page", "error") + return redirect(url_for("dashboard.index", next=request.url)) def on_model_change(self, form, model, is_created): changes = {}