-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add client-side validation for email and picture url fields #5856
Conversation
Signed-off-by: Vivek Vishal <[email protected]>
🚀 Preview for commit fbbebe7 at: https://66d463d25429312a1edc6549--layer5.netlify.app |
Signed-off-by: Vivek Vishal <[email protected]>
🚀 Preview for commit 3c974b5 at: https://66d469aab15368323b37f867--layer5.netlify.app |
|
||
if (!value) { | ||
error = "Required"; | ||
} else if (!/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same regex used by the other site forms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
const allowedImageExtensions = ["jpg", "jpeg", "png", "webp", "svg"]; | ||
const extension = value.split(".").pop().toLowerCase(); | ||
if (!allowedImageExtensions.includes(extension)) { | ||
error = "URL must point to an image file (jpg, jpeg, png, svg or webp)."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a gif?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
Co-authored-by: Lee Calcote <[email protected]> Signed-off-by: Vivek Vishal <[email protected]>
Co-authored-by: Lee Calcote <[email protected]> Signed-off-by: Vivek Vishal <[email protected]>
Signed-off-by: Vivek Vishal <[email protected]>
Signed-off-by: Vivek Vishal <[email protected]>
🚀 Preview for commit 95596dd at: https://66d47095498964065614936e--layer5.netlify.app |
Description
This PR fixes #5855
Notes for Reviewers
Signed commits