fix: make settings controls editable
This commit is contained in:
@@ -71,73 +71,86 @@ export function OrganizationDetailClient({
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form className="grid gap-4" onSubmit={handleSettingsSubmit}>
|
||||
<label className="flex items-center justify-between gap-4 rounded-md border p-3 text-sm">
|
||||
<span>
|
||||
<span className="block font-medium">开放公开注册</span>
|
||||
<span className="block text-xs text-muted-foreground">关闭后,注册页不再展示该机构;邀请链接仍可使用。</span>
|
||||
</span>
|
||||
<div className="rounded-md border p-3 text-sm">
|
||||
<Checkbox
|
||||
aria-label="开放公开注册"
|
||||
controlFirst={false}
|
||||
defaultChecked={organization.registrationEnabled}
|
||||
label={
|
||||
<span className="min-w-0">
|
||||
<span className="block font-medium">开放公开注册</span>
|
||||
<span className="block text-xs text-muted-foreground">关闭后,注册页不再展示该机构;邀请链接仍可使用。</span>
|
||||
</span>
|
||||
}
|
||||
name="registrationEnabled"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label className="flex items-center justify-between gap-4 rounded-md border p-3 text-sm">
|
||||
<span>
|
||||
<span className="block font-medium">启用 OIDC 登录</span>
|
||||
<span className="block text-xs text-muted-foreground">保存标准 OIDC 配置,后续登录入口按该开关展示。</span>
|
||||
</span>
|
||||
<Checkbox aria-label="启用 OIDC 登录" defaultChecked={organization.oidcEnabled} name="oidcEnabled" />
|
||||
</label>
|
||||
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<label className="grid gap-2 text-sm">
|
||||
<span className="font-medium">Issuer URL</span>
|
||||
<Input defaultValue={organization.oidcIssuerUrl} name="oidcIssuerUrl" placeholder="https://idp.example.com" />
|
||||
</label>
|
||||
<label className="grid gap-2 text-sm">
|
||||
<span className="font-medium">Client ID</span>
|
||||
<Input defaultValue={organization.oidcClientId} name="oidcClientId" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label className="grid gap-2 text-sm">
|
||||
<span className="font-medium">Client Secret</span>
|
||||
<Input
|
||||
name="oidcClientSecret"
|
||||
placeholder={organization.oidcHasClientSecret ? "已配置,留空则不修改" : "未配置"}
|
||||
type="password"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<label className="grid gap-2 text-sm">
|
||||
<span className="font-medium">Scopes</span>
|
||||
<Input defaultValue={organization.oidcScopes} name="oidcScopes" placeholder="openid profile email" />
|
||||
</label>
|
||||
<label className="grid gap-2 text-sm">
|
||||
<span className="font-medium">Redirect URI</span>
|
||||
<Input defaultValue={organization.oidcRedirectUri} name="oidcRedirectUri" placeholder="/api/auth/oidc/callback" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label className="grid gap-2 text-sm">
|
||||
<span className="font-medium">Avatar Claim</span>
|
||||
<Input defaultValue={organization.oidcAvatarClaim} name="oidcAvatarClaim" placeholder="picture" />
|
||||
</label>
|
||||
|
||||
<label className="flex items-center justify-between gap-4 rounded-md border p-3 text-sm">
|
||||
<span>
|
||||
<span className="block font-medium">OIDC 自动开户</span>
|
||||
<span className="block text-xs text-muted-foreground">首次 OIDC 登录时自动创建账号并进入本机构。</span>
|
||||
</span>
|
||||
<div className="rounded-md border p-3 text-sm">
|
||||
<Checkbox
|
||||
aria-label="OIDC 自动开户"
|
||||
controlFirst={false}
|
||||
defaultChecked={organization.oidcEnabled}
|
||||
label={
|
||||
<span className="min-w-0">
|
||||
<span className="block font-medium">启用 OIDC 登录</span>
|
||||
<span className="block text-xs text-muted-foreground">保存标准 OIDC 配置,后续登录入口按该开关展示。</span>
|
||||
</span>
|
||||
}
|
||||
name="oidcEnabled"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<Input
|
||||
defaultValue={organization.oidcIssuerUrl}
|
||||
label="Issuer URL"
|
||||
name="oidcIssuerUrl"
|
||||
placeholder="https://idp.example.com"
|
||||
/>
|
||||
<Input defaultValue={organization.oidcClientId} label="Client ID" name="oidcClientId" />
|
||||
</div>
|
||||
|
||||
<Input
|
||||
label="Client Secret"
|
||||
name="oidcClientSecret"
|
||||
placeholder={organization.oidcHasClientSecret ? "已配置,留空则不修改" : "未配置"}
|
||||
type="password"
|
||||
/>
|
||||
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<Input
|
||||
defaultValue={organization.oidcScopes}
|
||||
label="Scopes"
|
||||
name="oidcScopes"
|
||||
placeholder="openid profile email"
|
||||
/>
|
||||
<Input
|
||||
defaultValue={organization.oidcRedirectUri}
|
||||
label="Redirect URI"
|
||||
name="oidcRedirectUri"
|
||||
placeholder="/api/auth/oidc/callback"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Input
|
||||
defaultValue={organization.oidcAvatarClaim}
|
||||
label="Avatar Claim"
|
||||
name="oidcAvatarClaim"
|
||||
placeholder="picture"
|
||||
/>
|
||||
|
||||
<div className="rounded-md border p-3 text-sm">
|
||||
<Checkbox
|
||||
controlFirst={false}
|
||||
defaultChecked={organization.oidcAutoProvision}
|
||||
label={
|
||||
<span className="min-w-0">
|
||||
<span className="block font-medium">OIDC 自动开户</span>
|
||||
<span className="block text-xs text-muted-foreground">首次 OIDC 登录时自动创建账号并进入本机构。</span>
|
||||
</span>
|
||||
}
|
||||
name="oidcAutoProvision"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{settingsMessage ? (
|
||||
<p className="rounded-md bg-secondary px-3 py-2 text-sm text-secondary-foreground" role="status">
|
||||
|
||||
Reference in New Issue
Block a user