forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfieldRequirements.js
More file actions
58 lines (57 loc) · 1.71 KB
/
fieldRequirements.js
File metadata and controls
58 lines (57 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { ref } from 'yup'
import { t } from '@lingui/macro'
export const fieldRequirements = {
email: {
required: { message: t`Email cannot be empty` },
email: { message: t`Invalid email` },
},
displayName: { required: { message: t`Display name cannot be empty` } },
password: {
required: { message: t`Password cannot be empty` },
min: {
minLength: 12,
message: t`Password must be at least 12 characters long`,
},
},
confirmPassword: {
required: { message: t`Password confirmation cannot be empty` },
oneOf: { types: [ref('password')], message: t`Passwords must match` },
},
lang: {
required: { message: t`Please choose your preferred language` },
oneOf: { types: ['ENGLISH', 'FRENCH'], message: '' },
},
twoFactorCode: {
typeError: { message: t`Verification code must only contains numbers` },
required: { message: t`Code field must not be empty` },
},
domainUrl: {
required: { message: t`Domain url field must not be empty` },
},
phoneNumber: {
matches: {
message: t`Phone number must be a valid phone number that is 10-15 digits long`,
},
required: { message: t`Phone number field must not be empty` },
},
acronym: {
matches: {
regex: /^[A-Z]+(?:_[A-Z]+)*$/gm,
message: t`Acronyms can only use upper case letters and underscores`,
},
max: {
maxLength: 50,
message: t`Acronyms must be at most 50 characters`,
},
},
field: {
required: { message: t`This field cannot be empty` },
},
selector: {
required: { message: t`Selector cannot be empty` },
matches: {
regex: /^([\S]+)([.]_domainkey)$/gm,
message: t`Selector must be string ending in '._domainkey'`,
},
},
}