fix: admin/accounts: shouldn't display require_password_change for groups

Massimo Melina committed Mar 1, 2025 at 00:29 UTC b382d584712221b59f1fc03a45976e58833ce299
2 files changed +8 -5
admin/src/AccountForm.ts
+7 -4
@@ -68,17 +68,20 @@ export default function AccountForm({ account, done, groups, addToBar, reload }:
68 },
69 !isGroup && !pluginAuth && { k: 'password2', xs: 6, md: 4, type: 'password', autoComplete: 'new-password', label: 'Repeat password',
70 getError: (x, { values }) => (x||'') !== (values.password||'') && "Enter same password" },
71 +
72 { k: 'disabled', comp: BoolField, fromField: x=>!x, toField: x=>!x, label: "Enabled", xs: 12, sm: 6, lg: 8,
73 helperText: !values.disabled && values.canLogin === false ? h(Box, { color: 'warning.main', component: 'span' }, "Login is prevented because all of its groups are disabled")
74 : "Login is prevented if account is disabled, or all its groups are disabled" },
74 - { k: 'ignore_limits', comp: BoolField, xs: true,
75 + { k: 'ignore_limits', comp: BoolField, xs: 12, sm: 6, lg: 4,
76 helperText: values.ignore_limits ? "Speed limits don't apply to this account" : "Speed limits apply to this account" },
76 - { k: 'admin', comp: BoolField, fromField: (v:boolean) => v||null, label: "Admin-panel access", xs: 12, sm: 6, lg: 4,
77 +
78 + { k: 'admin', comp: BoolField, fromField: (v:boolean) => v||null, label: "Admin-panel access", xs: 12, sm: isGroup ? 6 : 4, lg: isGroup ? 8 : 4,
79 helperText: "To access THIS interface you are using right now",
80 ...!account.admin && account.adminActualAccess && { value: true, disabled: true, helperText: "This permission is inherited. To disable it, act on the groups." },
81 },
80 - { k: 'disable_password_change', comp: BoolField, fromField: x=>!x, toField: x=>!x, label: "Allow password change", xs: true },
81 - { k: 'require_password_change', comp: BoolField, xs: 12, lg: 4, helperText: "At first login" },
82 + { k: 'disable_password_change', comp: BoolField, fromField: x=>!x, toField: x=>!x, label: "Allow password change", xs: 12, sm: 4 },
83 + !isGroup && { k: 'require_password_change', comp: BoolField, xs: 12, sm: 4, helperText: "At first login" },
84 +
85 !members ? null
86 : isGroup && !members.length ? h(Box, {}, "No members")
87 : members.length > 0 && h(Box, {}, `${members.length} members: `,
src/perm.ts
+1 -1
@@ -23,7 +23,7 @@ export interface Account {
23 expire?: Date
24 days_to_live?: number // this is not inherited, but it will affect sub-accounts via 'expire'
25 allow_net?: string
26 - require_password_change?: boolean
26 + require_password_change?: boolean // not inherited
27 notes?: string
28 plugin?: { id?: string, auth?: boolean, [rest: string]: unknown }
29 }