Merge pull request 'Auto-commit local changes before build (2026-01-13 12:52:53)' (#109) from v20260113-04-edge-initial-setup-users-exist into main
Reviewed-on: #109
This commit is contained in:
commit
3a31b6c5d2
@ -1 +1 @@
|
||||
v20260113-03-runchecks-overall-remark
|
||||
v20260113-04-edge-initial-setup-users-exist
|
||||
|
||||
@ -18,8 +18,9 @@ from ..models import User
|
||||
auth_bp = Blueprint("auth", __name__, url_prefix="/auth")
|
||||
|
||||
|
||||
def admin_exists() -> bool:
|
||||
return db.session.query(User.id).filter_by(role="admin").first() is not None
|
||||
def users_exist() -> bool:
|
||||
# Initial setup should only run on a fresh install where NO users exist yet.
|
||||
return db.session.query(User.id).first() is not None
|
||||
|
||||
|
||||
def generate_captcha():
|
||||
@ -55,7 +56,7 @@ def captcha_required(func):
|
||||
@captcha_required
|
||||
def login():
|
||||
if request.method == "GET":
|
||||
if not admin_exists():
|
||||
if not users_exist():
|
||||
return redirect(url_for("auth.initial_setup"))
|
||||
|
||||
question, answer = generate_captcha()
|
||||
@ -98,8 +99,8 @@ def logout():
|
||||
|
||||
@auth_bp.route("/initial-setup", methods=["GET", "POST"])
|
||||
def initial_setup():
|
||||
if admin_exists():
|
||||
flash("An admin user already exists. Please log in.", "info")
|
||||
if users_exist():
|
||||
flash("Users already exist. Please log in.", "info")
|
||||
return redirect(url_for("auth.login"))
|
||||
|
||||
if request.method == "POST":
|
||||
|
||||
@ -20,6 +20,13 @@
|
||||
- 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.
|
||||
|
||||
---
|
||||
|
||||
## 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user