feat: Update regex for email and username validation
Updated the regex in 'isEmail' and 'isUsername' validators to adjust valid string length. It now allows for a shorter username and a longer domain in email addresses.
This commit is contained in:
parent
9c97420027
commit
6b944301cc
@ -1,12 +1,13 @@
|
||||
const Validators = {
|
||||
isEmail: (value: string) => {
|
||||
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,32}$/;
|
||||
return emailRegex.test(value)
|
||||
},
|
||||
isUsername: (value: string) => {
|
||||
const usernameRegex = /^[a-zA-Z0-9._]{3,16}$/;
|
||||
const usernameRegex = /^[a-zA-Z0-9._]{3,14}$/;
|
||||
return usernameRegex.test(value);
|
||||
},
|
||||
//displayName
|
||||
|
||||
isPassword: (value: string) => {
|
||||
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
|
||||
|
Loading…
x
Reference in New Issue
Block a user