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 11export 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,
33 message : "Invalid email address" ,
44}
55
6+ export const namePattern = {
7+ value : / ^ [ A - Z a - z \s \u00C0 - \u017F ] { 1 , 30 } $ / ,
8+ message : "Invalid name" ,
9+ }
10+
611export const passwordRules = ( isRequired = true ) => {
712 const rules : any = {
813 minLength : {
@@ -23,13 +28,15 @@ export const confirmPasswordRules = (
2328 isRequired = true ,
2429) => {
2530 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+ }
2835 }
2936
3037 if ( isRequired ) {
31- rules . required = "Password confirmation is required"
38+ rules . required = "Password confirmation is required" ;
3239 }
3340
34- return rules
41+ return rules ;
3542}
You can’t perform that action at this time.
0 commit comments