feat: Add registration mode setting (invite-only vs public)
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

Backend:
- Added registrationMode and requireInviteCode to settings endpoint
- Values pulled from REGISTRATION_MODE and REQUIRE_INVITE_CODE env vars
- Defaults to 'invite_only' mode (requires invite code)

Frontend:
- Added Registration Mode dropdown to General settings tab
- Options: 'Invite Only' or 'Public Registration'
- Spans full width on desktop layout
- Settings persist with backend save

This allows admins to toggle between invite-only and public registration modes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andrei
2025-10-08 11:42:41 +00:00
parent 6829bc6061
commit 2ed1c09657
2 changed files with 18 additions and 1 deletions

View File

@@ -356,6 +356,10 @@ export class DashboardService {
timezone: process.env.TZ || 'UTC', timezone: process.env.TZ || 'UTC',
language: 'en', language: 'en',
// Registration Settings
registrationMode: process.env.REGISTRATION_MODE || 'invite_only', // 'public' or 'invite_only'
requireInviteCode: process.env.REQUIRE_INVITE_CODE === 'true' || true,
// Security Settings // Security Settings
enforcePasswordPolicy: true, enforcePasswordPolicy: true,
minPasswordLength: 8, minPasswordLength: 8,

View File

@@ -177,7 +177,7 @@ export default function SettingsPage() {
<FormControl fullWidth> <FormControl fullWidth>
<InputLabel>Language</InputLabel> <InputLabel>Language</InputLabel>
<Select <Select
value={settings.language} value={settings.language || 'en'}
label="Language" label="Language"
onChange={(e) => setSettings({ ...settings, language: e.target.value })} onChange={(e) => setSettings({ ...settings, language: e.target.value })}
> >
@@ -188,6 +188,19 @@ export default function SettingsPage() {
<MenuItem value="zh">Chinese</MenuItem> <MenuItem value="zh">Chinese</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
<FormControl fullWidth sx={{ gridColumn: { xs: '1', md: 'span 2' } }}>
<InputLabel>Registration Mode</InputLabel>
<Select
value={settings.registrationMode || 'invite_only'}
label="Registration Mode"
onChange={(e) => setSettings({ ...settings, registrationMode: e.target.value })}
>
<MenuItem value="invite_only">Invite Only (Requires Invite Code)</MenuItem>
<MenuItem value="public">Public Registration (Open to All)</MenuItem>
</Select>
</FormControl>
</Box> </Box>
</TabPanel> </TabPanel>