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

[Fix] - Issue with Email Validation and API Call Trigger on Login #7510 #7596

Merged

Conversation

Karankhatik
Copy link
Contributor

Purpose: Enhance email validation in the SignInUpForm component.

Changes:

  • Implemented strict email format validation.
  • Disabled the "Continue" button until email validation is complete.
  • Displayed error messages for invalid email formats.

image

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This pull request enhances email validation in the SignInUpForm component, improving user experience and data integrity during the sign-in/up process.

  • Implemented strict email format validation in packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpForm.tsx
  • Added logic to disable the "Continue" button until email validation is complete
  • Introduced error message display for invalid email formats
  • Improved user feedback by preventing submission of invalid email addresses
  • Enhanced the overall sign-in/up flow by ensuring valid email input before proceeding

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 79 to 82
if (form?.formState?.errors?.email) {
setShowErrors(true);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider moving this validation logic to the continueWithCredentials function for better separation of concerns.

@Bonapara
Copy link
Member

Hi @Karankhatik, thanks for your PR. We would like the validation check to occur only when the "Continue" button is pressed, rather than while the user is typing.

We don't want to show an error message if the user hasn't completed their input.

@@ -76,6 +76,10 @@ export const SignInUpForm = () => {
if (signInUpStep === SignInUpStep.Init) {
continueWithEmail();
} else if (signInUpStep === SignInUpStep.Email) {
if (isDefined(form?.formState?.errors?.email)) {
Copy link
Member

Choose a reason for hiding this comment

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

using isDefined is better to avoid unwanted falsy behaviors

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

Thank you @Karankhatik. I have made a small modification :)

@charlesBochet charlesBochet merged commit 284b267 into twentyhq:main Oct 13, 2024
8 checks passed
Copy link

Thanks @Karankhatik for your contribution!
This marks your 2nd PR on the repo. You're top 17% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants