diff --git a/apps/web/src/auth/console-auth-settings.tsx b/apps/web/src/auth/console-auth-settings.tsx index a65efc0..fdd9237 100644 --- a/apps/web/src/auth/console-auth-settings.tsx +++ b/apps/web/src/auth/console-auth-settings.tsx @@ -14,6 +14,7 @@ export function ConsoleAuthSettings({ const [enabled, setEnabled] = useState(false); const [password, setPassword] = useState(''); const [confirmation, setConfirmation] = useState(''); + const [idleMinutes, setIdleMinutes] = useState('30'); const [saving, setSaving] = useState(false); const [notice, setNotice] = useState(''); const [error, setError] = useState(''); @@ -25,6 +26,7 @@ export function ConsoleAuthSettings({ if (!active) return; setStatus(next); setEnabled(next.protectionEnabled); + setIdleMinutes(String(next.sessionIdleTimeoutMinutes)); }, () => { if (active) setError('无法读取密码保护设置。'); @@ -52,11 +54,15 @@ export function ConsoleAuthSettings({ } setSaving(true); try { - const input = - enabled && !status.configured ? { enabled: true, newPassword: password } : { enabled }; + const input = { + enabled, + ...(enabled && !status.configured ? { newPassword: password } : {}), + idleTimeoutMinutes: Math.min(1440, Math.max(5, Math.round(Number(idleMinutes) || 30))), + }; const next = await source.update(input); setStatus(next); setEnabled(next.protectionEnabled); + setIdleMinutes(String(next.sessionIdleTimeoutMinutes)); setPassword(''); setConfirmation(''); setNotice(next.protectionEnabled ? '密码保护已启用。' : '密码保护已关闭。'); @@ -115,6 +121,17 @@ export function ConsoleAuthSettings({ ) : null} {status.configured ?

访问密码已配置,不会在页面或 API 中回显。

: null} + + setIdleMinutes(event.target.value)} + /> + 无操作达到该时长后自动退出,范围 5 到 1440 分钟。 {error ?

{error}

: null} {notice ?

{notice}

: null} + ))} + + ) : null} {form.targetMode === 'group' ? ( +

+ 发送时可插入 {'${time}'}{'${random}'}。 +