admin/accounts: better layout

Massimo Melina committed Feb 22, 2025 at 10:49 UTC 7ba4dfafeb0ccfb4883d713b7a407cb9330e90b2
1 file changed +4 -4
admin/src/AccountForm.ts
+4 -4
@@ -58,15 +58,15 @@ export default function AccountForm({ account, done, groups, addToBar, reload }:
58 ...wantArray(addToBar),
59 ],
60 fields: [
61 - { k: 'username', label: isGroup ? 'Group name' : undefined, autoComplete: 'off', required: true, lg: isGroup ? 12 : 4,
61 + { k: 'username', label: isGroup ? 'Group name' : undefined, autoComplete: 'off', required: true, md: isGroup && !pluginAuth ? 12 : 4,
62 getError: v => v !== account.username && apiCall('get_account', { username: v })
63 .then(got => got?.username === account.username ? "usernames are case-insensitive" : "already used", () => false),
64 },
65 - pluginAuth && h(Alert, { severity: 'info' }, " Authentication handled by a plugin"),
66 - !isGroup && !pluginAuth && { k: 'password', md: 6, lg: 4, type: 'password', autoComplete: 'new-password', required: add,
65 + pluginAuth && { k: '', md: 8, comp: h(Alert, { severity: 'info' }, " Authentication handled by a plugin") },
66 + !isGroup && !pluginAuth && { k: 'password', xs: 6, md: 4, type: 'password', autoComplete: 'new-password', required: add,
67 label: add ? "Password" : "Change password"
68 },
69 - !isGroup && !pluginAuth && { k: 'password2', md: 6, lg: 4, type: 'password', autoComplete: 'new-password', label: 'Repeat password',
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 { k: 'disabled', comp: BoolField, fromField: x=>!x, toField: x=>!x, label: "Enabled", xs: 12, sm: 6, lg: 8,
72 helperText: !values.disabled && values.canLogin === false ? h(Box, { color: 'warning.main', component: 'span' }, "Login is prevented because all of its groups are disabled")