use 'required'
Massimo Melina committed
May 30, 2022 at 12:45 UTC
cef8ec55efab67ee07624a228c745b958956b5e1
2 files changed
+5
-7
admin/src/AccountsPage.ts
+3
-3
@@ -164,9 +164,9 @@ function AccountForm({ account, done, groups, close }: FormProps) {
164
account2icon(values, { fontSize: 'large', sx: { p: 1 }})
165
],
166
fields: [
167
- { k: 'username', label: group ? 'Group name' : undefined, autoComplete: 'off', validate: x => x>'' || "Required", xl: group ? 12 : 4 },
168
- !group && { k: 'password', md: 6, xl: 4, type: 'password', autoComplete: 'new-password', label: add ? "Password" : "Change password",
169
- validate: x => x>'' || !add || "Please provide a password"
167
+ { k: 'username', label: group ? 'Group name' : undefined, autoComplete: 'off', required: true, xl: group ? 12 : 4 },
168
+ !group && { k: 'password', md: 6, xl: 4, type: 'password', autoComplete: 'new-password', required: add,
169
+ label: add ? "Password" : "Change password"
170
},
171
!group && { k: 'password2', md: 6, xl: 4, type: 'password', autoComplete: 'new-password', label: 'Repeat password',
172
validate: (x, { values }) => x === values.password || "Enter same password" },
admin/src/FileForm.ts
+2
-4
@@ -77,10 +77,8 @@ export default function FileForm({ file }: { file: VfsNode }) {
77
}
78
},
79
fields: [
80
- isRoot ? h(Alert,{ severity: 'info' }, "This is Home, the root of your shared files. Options set here will be applied to all files.") : {
81
- k: 'name', validate: x => x>'' || `Required`,
82
- helperText: source && "You can decide a name that's different from the one on your disk",
83
- },
80
+ isRoot ? h(Alert,{ severity: 'info' }, "This is Home, the root of your shared files. Options set here will be applied to all files.")
81
+ : { k: 'name', required: true, helperText: source && "You can decide a name that's different from the one on your disk" },
82
isRoot ? { k: 'source', comp: FileField, files: false, helperText: "If you specify a folder here, its files will be listed in the home" }
83
: (hasSource && { k: 'source', comp: DisplayField, multiline: true }),
84
!isRoot && { k: 'can_read', label:"Who can download", xl: showCanSee && 6, comp: WhoField, parent, accounts, inherit: inheritedPerms.can_read,