Skip to content
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

Merged
merged 6 commits into from
Sep 7, 2024

Conversation

vishalvivekm
Copy link
Member

Description

This PR fixes #5855

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

@l5io
Copy link
Contributor

l5io commented Sep 1, 2024

🚀 Preview for commit fbbebe7 at: https://66d463d25429312a1edc6549--layer5.netlify.app

@l5io
Copy link
Contributor

l5io commented Sep 1, 2024

🚀 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)) {
Copy link
Member

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?

Copy link
Member Author

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).";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a gif?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

vishalvivekm and others added 2 commits September 1, 2024 19:00
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]>
@l5io
Copy link
Contributor

l5io commented Sep 1, 2024

🚀 Preview for commit 95596dd at: https://66d47095498964065614936e--layer5.netlify.app

@sudhanshutech sudhanshutech merged commit 403fdc6 into layer5io:master Sep 7, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

add client side form field validation for email and profile picture
4 participants