diff --git a/server/routers/auth.py b/server/routers/auth.py index ccae963..3ecdcef 100644 --- a/server/routers/auth.py +++ b/server/routers/auth.py @@ -245,11 +245,23 @@ async def register( ) # --- Invite code validation --- + is_test_account = False if has_invite: if not _admin_service: raise HTTPException(status_code=503, detail="Admin service not initialized") if not await _admin_service.validate_invite_code(request_body.invite_code): raise HTTPException(status_code=400, detail="Invalid or expired invite code") + # Check if this invite flags new accounts as test accounts + invite_details = await _admin_service.get_invite_code_details(request_body.invite_code) + if invite_details and invite_details.get("marks_as_test"): + is_test_account = True + logger.info( + "test_seed_account_registering", + extra={ + "username": request_body.username, + "invite_code": request_body.invite_code, + }, + ) else: # No invite code — check if open signups are allowed if config.INVITE_ONLY and config.DAILY_OPEN_SIGNUPS == 0: @@ -277,6 +289,7 @@ async def register( username=request_body.username, password=request_body.password, email=request_body.email, + is_test_account=is_test_account, ) if not result.success: diff --git a/server/services/auth_service.py b/server/services/auth_service.py index 6f7b2ac..794b1ba 100644 --- a/server/services/auth_service.py +++ b/server/services/auth_service.py @@ -101,6 +101,7 @@ class AuthService: password: str, email: Optional[str] = None, guest_id: Optional[str] = None, + is_test_account: bool = False, ) -> RegistrationResult: """ Register a new user account. @@ -110,6 +111,7 @@ class AuthService: password: Plain text password. email: Optional email address. guest_id: Guest session ID if converting. + is_test_account: Mark this user as a soak-harness test account. Returns: RegistrationResult with user or error. @@ -151,6 +153,7 @@ class AuthService: guest_id=guest_id, verification_token=verification_token, verification_expires=verification_expires, + is_test_account=is_test_account, ) if not user: