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

Modified mentee registration validations #201

Merged

Conversation

Disura-Randunu
Copy link
Contributor

@Disura-Randunu Disura-Randunu commented Oct 1, 2024

Purpose

The purpose of this PR is to fix #128

Goals

Improve validations on Mentee registration.

Approach

Modified Mentee Application Validation Schema to handle possible invalids for several fields (contact no, graduated year, year of study. cv link)

Screenshots

Checklist

  • This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
  • I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Related PRs

Test environment

Learning

src/schemas.ts Outdated
contactNo: z
.string()
.min(1, { message: 'Contact number cannot be empty' })
.regex(/^\+[1-9]\d{1,14}$/, 'Invalid contact number'),
Copy link
Member

Choose a reason for hiding this comment

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

@Disura-Randunu Did you check this for multiple countries? Each country has different lengths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thats why a common length was added. Around 14 digits. Should start with + to indicate the country code

Copy link
Member

Choose a reason for hiding this comment

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

We probably need to say that you need to add + then let's remove + validations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/^+[1-9]\d{1,3}\d{6,12}$/
this is a bit more correct than before. can have upto 3 numbers after + which makes the country code. then 6-12 digits which is kind of standard amount of numbers in any country.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anjula-sack updated contactNo validation

Copy link
Member

@anjula-sack anjula-sack 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! @Disura-Randunu

@anjula-sack anjula-sack merged commit b89ea32 into sef-global:development Oct 5, 2024
1 check passed
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.

Contact number is not being validated in Mentee Application Form
2 participants