Osc 25 email validation only required#6308
Conversation
…eeping the required validation 1. Frontend Constants Files 2. Login Forms 3. Registration Forms 4. Backend Validation - Email field is still required - users must enter something in the email field - Email regex validation is disabled - users can enter any text without symbol/format restrictions
There was a problem hiding this comment.
Summary of Changes
Hello @kunz398, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request modifies the email input validation across the codebase. The primary goal is to relax the email format requirements by disabling regex-based validation, while ensuring that the email field remains mandatory for user input. This change provides more flexibility for users entering email addresses.
Highlights
- Email Validation Logic: I have updated the application's email validation logic to remove the strict regex pattern matching. This means that while an email address is still a required field, its format will no longer be validated against a specific pattern.
- Scope of Changes: The changes span across both frontend components (Login and Registration forms in
lesmisandpssspackages, and shared constants intupaia-webandui-components) and backend validation (central-serverandutilspackages) to ensure consistent behavior.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
| firstName: [fieldHasContent], | ||
| lastName: [fieldHasContent], | ||
| emailAddress: [fieldHasContent, isEmail], | ||
| emailAddress: [fieldHasContent], // , isEmail |
| // pattern: { | ||
| // value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, | ||
| // message: 'invalid email address', | ||
| // }, |
| // pattern: { | ||
| // value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, | ||
| // message: 'invalid email address', | ||
| // }, |
| // pattern: { | ||
| // value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, | ||
| // message: 'invalid email address', | ||
| // }, |
| // pattern: { | ||
| // value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, // Case-insensitive regex for email validation | ||
| // message: 'Invalid email address', | ||
| // }, |
| // pattern: { | ||
| // value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, | ||
| // message: 'Invalid email', | ||
| // }, |
| export const isEmail = value => { | ||
| if (!validator.isEmail(value.toString())) { | ||
| // Coerce to string before checking with validator | ||
| throw new ValidationError('Not a valid email address'); | ||
| } | ||
| // if (!validator.isEmail(value.toString())) { | ||
| // // Coerce to string before checking with validator | ||
| // throw new ValidationError('Not a valid email address'); | ||
| // } | ||
| }; |
There was a problem hiding this comment.
@kunz398 It looks like there are only four usages of this. Perhaps could even go as far as removing it entirely from the codebase
Otherwise the usages would probably be a bit confusing for the next dev reading the code. It’s a bit unexpected to see an isEmail callback when in fact it does nothing
jaskfla
left a comment
There was a problem hiding this comment.
Happy with all code deletions! In this case I actually agree with most of the comments from Gemini—there’s not really any point leaving commented-out dead code, so may as well clean those up
Just watch out that the PR title format. Here’s the docs again: https://beyond-essential.slab.com/posts/pr-titles-conventional-commits-avgsj3xb?shr=avgsj3xb
| export const isEmail = value => { | ||
| if (!validator.isEmail(value.toString())) { | ||
| // Coerce to string before checking with validator | ||
| throw new ValidationError('Not a valid email address'); | ||
| } | ||
| // if (!validator.isEmail(value.toString())) { | ||
| // // Coerce to string before checking with validator | ||
| // throw new ValidationError('Not a valid email address'); | ||
| // } | ||
| }; |
There was a problem hiding this comment.
@kunz398 It looks like there are only four usages of this. Perhaps could even go as far as removing it entirely from the codebase
Otherwise the usages would probably be a bit confusing for the next dev reading the code. It’s a bit unexpected to see an isEmail callback when in fact it does nothing
Removed email regex validation from both frontend and backend. Cleaned up comments and unused code related to email validation. Email fields are now only required, with no format restrictions.
jaskfla
left a comment
There was a problem hiding this comment.
Nice! Next step would be to move the Linear card into dev testing
Let me know in Slack when you’d like to do the testing, and I’ll spin up a deployment from this branch for you 🚀
Issue #:
Changes:
Commented out the email regex validation across your codebase while keeping the required validation
Email field is still required - users must enter something in the email field
Email regex validation is disabled - users can enter any text without symbol/format restrictions