feat(auth): public self-service registration (ALLOW_REGISTRATION)
Add POST /auth/register: creates a non-superuser then auto-logs in, returning the same TokenResponse as login. Gated by the new allow_registration setting (env ALLOW_REGISTRATION, default true); when disabled it raises PermissionDeniedError (403). Accounts remain admin-only for superusers. Tests cover create+login, duplicate (409), short password (422), and the disabled (403) path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,9 @@ class Settings(BaseSettings):
|
||||
jwt_algorithm: str = "HS256"
|
||||
access_token_ttl_seconds: int = 60 * 15 # 15 min
|
||||
refresh_token_ttl_seconds: int = 60 * 60 * 24 * 30 # 30 days (offline-first)
|
||||
# Public self-service sign-up. When disabled, accounts are created
|
||||
# admin-only (POST /admin/users). Registered users are never superusers.
|
||||
allow_registration: bool = True
|
||||
|
||||
# -- subsonic ---------------------------------------------------------
|
||||
# Symmetric key (any string) used to encrypt each user's recoverable
|
||||
|
||||
Reference in New Issue
Block a user