generated from goitacademy/react-homework-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from 001elijah/auth
fix valid name
- Loading branch information
Showing
3 changed files
with
8 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,38 +24,10 @@ export const validationSchemaRegister = yup.object().shape({ | |
userName: yup | ||
.string() | ||
.matches( | ||
/^[a-zA-Z0-9_]+( [a-zA-Z0-9_]+)?$/, | ||
'Only letters, numbers, underscores, and spaces are allowed', | ||
) | ||
.min(2, 'Minimum length 2 characters') | ||
.max(32, 'Maximum length 32 characters') | ||
.required('Name required'), | ||
email: yup | ||
.string() | ||
.matches( | ||
/^[\w.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, | ||
'Invalid email address. Example: [email protected]', | ||
) | ||
.required('Email required'), | ||
password: yup | ||
.string() | ||
.matches(/^\S*$/, 'Must not contain spaces') | ||
.matches( | ||
/^[a-zA-Z0-9!"@#$%^&*()]+$/, | ||
'Can only contain Latin letters, numbers, and signs', | ||
) | ||
.min(8, 'Minimum length 8 characters') | ||
.max(64, 'Maximum length 64 characters') | ||
.required('Password required'), | ||
}); | ||
|
||
export const validationSchemaEditProfile = yup.object().shape({ | ||
userName: yup | ||
.string() | ||
.matches( | ||
/^[a-zA-Z0-9_]+( [a-zA-Z0-9_]+)?$/, | ||
'Only letters, numbers, underscores, and spaces are allowed', | ||
) | ||
/^[a-zA-Z0-9]+([-_ ][a-zA-Z0-9]+)*$/, | ||
// 'Only letters, numbers, underscores, spaces, hyphens, and dashes are allowed between words', | ||
'Invalid name' | ||
) | ||
.min(2, 'Minimum length 2 characters') | ||
.max(32, 'Maximum length 32 characters') | ||
.required('Name required'), | ||
|
@@ -76,5 +48,4 @@ export const validationSchemaEditProfile = yup.object().shape({ | |
.min(8, 'Minimum length 8 characters') | ||
.max(64, 'Maximum length 64 characters') | ||
.required('Password required'), | ||
avatarUrl: yup.string(), | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters