Skip to content

Osc 25 email validation only required#6308

Open
kunz398 wants to merge 4 commits into
devfrom
osc-25-email-validation-only-required
Open

Osc 25 email validation only required#6308
kunz398 wants to merge 4 commits into
devfrom
osc-25-email-validation-only-required

Conversation

@kunz398

@kunz398 kunz398 commented Jul 15, 2025

Copy link
Copy Markdown
Collaborator

Issue #:

Changes:

Commented out the email regex validation across your codebase while keeping 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

kunz398 added 2 commits July 8, 2025 12:02
…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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 lesmis and psss packages, and shared constants in tupaia-web and ui-components) and backend validation (central-server and utils packages) 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

  1. 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request disables email format validation across the application. While the changes are consistently applied, disabling email validation introduces risks to data integrity and security. Consider the implications carefully.

Comment thread packages/central-server/src/apiV2/userAccounts/RegisterUserAccounts.js Outdated
firstName: [fieldHasContent],
lastName: [fieldHasContent],
emailAddress: [fieldHasContent, isEmail],
emailAddress: [fieldHasContent], // , isEmail

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Consider removing the commented-out isEmail validator for better code clarity. Version control can be used to retrieve it if needed.

Suggested change
emailAddress: [fieldHasContent], // , isEmail
emailAddress: [fieldHasContent],

Comment on lines +72 to +75
// pattern: {
// value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
// message: 'invalid email address',
// },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the commented-out pattern property to improve code maintainability.

Comment on lines +114 to +117
// pattern: {
// value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
// message: 'invalid email address',
// },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the commented-out pattern property to improve code maintainability.

Comment on lines +50 to +53
// pattern: {
// value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
// message: 'invalid email address',
// },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the commented-out pattern property to improve code maintainability.

Comment on lines +11 to +14
// pattern: {
// value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, // Case-insensitive regex for email validation
// message: 'Invalid email address',
// },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the commented-out pattern property to improve readability and maintainability.

Comment thread packages/ui-components/src/constants.js Outdated
Comment on lines +6 to +9
// pattern: {
// value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
// message: 'Invalid email',
// },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the commented-out pattern property to keep the code clean and maintainable.

Comment on lines 82 to 87
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');
// }
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The isEmail function is now effectively a no-op. Consider removing it entirely to avoid confusion, especially if it's no longer used elsewhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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 jaskfla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment on lines 82 to 87
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');
// }
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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.
Comment thread packages/central-server/src/apiV2/userAccounts/RegisterUserAccounts.js Outdated

@jaskfla jaskfla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 🚀

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants