File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
1
export const emailPattern = {
2
- value : / ^ [ A - Z 0 - 9 . _ % + - ] + @ [ A - Z 0 - 9 . - ] + \. [ A - Z ] { 2 , 4 } $ / i,
2
+ value : / ^ [ A - Z 0 - 9 . _ % + - ] + @ [ A - Z 0 - 9 . - ] + \. [ A - Z ] { 2 , } $ / i,
3
3
message : "Invalid email address" ,
4
4
}
5
5
6
+ export const namePattern = {
7
+ value : / ^ [ A - Z a - z \s \u00C0 - \u017F ] { 1 , 30 } $ / ,
8
+ message : "Invalid name" ,
9
+ }
10
+
6
11
export const passwordRules = ( isRequired = true ) => {
7
12
const rules : any = {
8
13
minLength : {
@@ -23,13 +28,15 @@ export const confirmPasswordRules = (
23
28
isRequired = true ,
24
29
) => {
25
30
const rules : any = {
26
- validate : ( value : string ) =>
27
- value === getValues ( ) . password || "The passwords do not match" ,
31
+ validate : ( value : string ) => {
32
+ const password = getValues ( ) . password || getValues ( ) . new_password ;
33
+ return value === password ? true : "The passwords do not match" ;
34
+ }
28
35
}
29
36
30
37
if ( isRequired ) {
31
- rules . required = "Password confirmation is required"
38
+ rules . required = "Password confirmation is required" ;
32
39
}
33
40
34
- return rules
41
+ return rules ;
35
42
}
You can’t perform that action at this time.
0 commit comments