admin/accounts: show days_to_live only if expiration is not set
Massimo Melina committed
Apr 15, 2025 at 15:55 UTC
17c02cc62d410bd86618dfb0b17baddd2b3e40e6
1 file changed
+3
-4
admin/src/AccountForm.ts
+3
-4
@@ -29,7 +29,6 @@ export default function AccountForm({ account, done, groups, addToBar, reload }:
29
const add = !account.username
30
const { isGroup } = values
31
const ref = useRef<HTMLFormElement>()
32
- const expired = Boolean(values.expire)
32
const { members } = account
33
const pluginAuth = account.plugin?.auth
34
return h(Form, {
@@ -100,10 +99,10 @@ export default function AccountForm({ account, done, groups, addToBar, reload }:
99
+ (belongsOptions.length ? '' : ". Now disabled because there are no groups to select, create one first.")
100
},
101
{ k: 'allow_net', comp: NetmaskField, label: "Allowed network address", sm: 6, placeholder: "Allow from any address" },
103
- { k: 'expire', label: "Expiration", xs: true, comp: DateTimeField, toField: x => x && new Date(x),
102
+ { k: 'expire', label: "Expiration", xs: values.expire ? 12 : 6, comp: DateTimeField, toField: x => x && new Date(x),
103
helperText: "When expired, login won't be allowed" },
105
- { k: 'days_to_live', xs: 12, sm: 6, comp: NumberField, disabled: expired, step: 'any', min: 1/1000, // 10 minutes
106
- helperText: "Used to set expiration on first login" + (expired ? " (already expired)" : '') },
104
+ !values.expire && { k: 'days_to_live', xs: 12, sm: 6, comp: NumberField, step: 'any', min: 1/1000, // 10 minutes
105
+ helperText: "Used to set expiration on first login" },
106
{ k: 'redirect', comp: VfsPathField, placeholder: "no", sm: 6,
107
helperText: "If you want this account to be redirected to a specific folder/address (or even file) at login time" },
108
{ k: 'notes', multiline: true, sm: 6 },