Compare commits

..

No commits in common. "3a31b6c5d2466689647a215e5ea399dcdbd4d210" and "506e1f56cd4dcd670e4ec8bfa09f69d5bb2ac342" have entirely different histories.

3 changed files with 6 additions and 14 deletions

View File

@ -1 +1 @@
v20260113-04-edge-initial-setup-users-exist v20260113-03-runchecks-overall-remark

View File

@ -18,9 +18,8 @@ from ..models import User
auth_bp = Blueprint("auth", __name__, url_prefix="/auth") auth_bp = Blueprint("auth", __name__, url_prefix="/auth")
def users_exist() -> bool: def admin_exists() -> bool:
# Initial setup should only run on a fresh install where NO users exist yet. return db.session.query(User.id).filter_by(role="admin").first() is not None
return db.session.query(User.id).first() is not None
def generate_captcha(): def generate_captcha():
@ -56,7 +55,7 @@ def captcha_required(func):
@captcha_required @captcha_required
def login(): def login():
if request.method == "GET": if request.method == "GET":
if not users_exist(): if not admin_exists():
return redirect(url_for("auth.initial_setup")) return redirect(url_for("auth.initial_setup"))
question, answer = generate_captcha() question, answer = generate_captcha()
@ -99,8 +98,8 @@ def logout():
@auth_bp.route("/initial-setup", methods=["GET", "POST"]) @auth_bp.route("/initial-setup", methods=["GET", "POST"])
def initial_setup(): def initial_setup():
if users_exist(): if admin_exists():
flash("Users already exist. Please log in.", "info") flash("An admin user already exists. Please log in.", "info")
return redirect(url_for("auth.login")) return redirect(url_for("auth.login"))
if request.method == "POST": if request.method == "POST":

View File

@ -20,13 +20,6 @@
- Added support to display the overall remark (overall_message) on the Run Checks page. - Added support to display the overall remark (overall_message) on the Run Checks page.
- Ensured consistency between the Run Checks view and the Job Details page where the overall remark was already available. - Ensured consistency between the Run Checks view and the Job Details page where the overall remark was already available.
---
## v20260113-04-edge-initial-setup-users-exist
- Fixed incorrect redirect to the “Initial admin setup” page when users already exist.
- Changed the setup check from “admin user exists” to “any user exists”, so existing environments always show the login page instead of allowing a new initial admin to be created.
- Prevented direct access to the initial setup route when at least one user is present (redirects to login).
*** ***
## v0.1.20 ## v0.1.20