feat(server): register flow flags accounts from test-seed invites
When a user registers with an invite_code whose marks_as_test=TRUE, their users_v2.is_test_account is set to TRUE. Normal invite codes and invite-less signups are unaffected. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user