fix: gate LocalUser machinery on multi_user_enabled for single-user backward compat

- auth() only queries LocalUser table when multi_user_enabled=True
- login() only shows signup link when multi_user_enabled AND allow_local_signup
- signup page and POST endpoint both check multi_user_enabled first
- Move local-auth imports to module level in auth.py (no re-import overhead)
- Fix signup rollback: flush before email send, commit only on success
- Update allow_local_signup config description to document prerequisite
- Add test: single-user mode skips LocalUser table entirely
- Patch multi_user_enabled=True on all local-login integration tests

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-07 13:35:10 +00:00
parent 43f3f6bdbe
commit b5b285ebe6
4 changed files with 114 additions and 46 deletions
+3 -2
View File
@@ -177,8 +177,9 @@ class Settings(BaseSettings):
default=False,
description=(
"Allow users to self-register with email and password. "
"Requires email (SMTP) to be configured for verification emails. "
"Default: False (registration disabled, admin creates users)."
"Has no effect unless MULTI_USER_ENABLED is also True. "
"Requires SMTP to be configured so verification emails can be sent. "
"Default: False (registration disabled — admin creates users manually)."
),
)