You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.matches(/^(?:[a-z0-9_-]{3,40}|[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})$/)//accept random string (min 3 max 40) of smaller case letters _ - and numbers OR email in lowercase as username
39
+
.withMessage('username is invalid')
40
+
41
+
// Validate phone (optional)
42
+
req.checkBody('phone')
43
+
.optional()
44
+
.trim()
45
+
.matches(/^[0-9]{7,15}$/)
46
+
.withMessage('phone must be a valid number between 7 and 15 digits')
47
+
48
+
// Validate phone_code (required if phone is provided)
49
+
req.checkBody('phone_code')
50
+
.optional({checkFalsy: true})
51
+
.trim()
52
+
.isLength({min: 2,max: 4})// Length between 2 and 4 characters
53
+
.withMessage('Phone code must be between 2 and 4 characters')
0 commit comments