Skip to content

refactor: extract repeated email validation into reusable utility #548#577

Open
jikrana1 wants to merge 1 commit into
AnthropicBots:mainfrom
jikrana1:feature/548-refactor-email-validator
Open

refactor: extract repeated email validation into reusable utility #548#577
jikrana1 wants to merge 1 commit into
AnthropicBots:mainfrom
jikrana1:feature/548-refactor-email-validator

Conversation

@jikrana1

@jikrana1 jikrana1 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #548

Refactored the repeated email validation logic into a single reusable utility function. The email regex was previously hardcoded across three different authentication routes (/signup, /login, and /forgot-password).

Changes Made

  • Created a new file backend/utils/validators.js containing an exported isValidEmail(email) function.
  • Updated backend/routes/authRoutes.js:
    • Imported the new isValidEmail validator.
    • Replaced the 3 duplicated const emailRegex = ... blocks with a single call to isValidEmail(email).

Benefits

  • Reduces code duplication: 3 repeated validation blocks reduced to 1 shared function.
  • Improves maintainability: If the email regex ever needs to be updated, it can now be done in exactly one place.

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Bhuvansh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@hydra-maintainer

Copy link
Copy Markdown

💡 Suggested reviewers based on relevant file history: @BhakktiGautam, @zaibamachhaliya

@hydra-maintainer

Copy link
Copy Markdown

🔴 PR Health Score: 40/100

This PR's health score is below the 75/100 threshold for a healthy label.

Status Signal
Test coverage
Linked issue
PR description (≥50 chars)
DCO sign-off
⬜ 0 approval(s) Approvals
Diff size < 400 lines

Improving these signals will help reviewers engage faster and raise your score. 💪

@BHUVANSH855 BHUVANSH855 added SSoC26 Program label for Social Summer of Code Season 5. Merge Conflicts. PR has merge time conflicts, update your local branch and then re commit with updated changes. labels Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

health: 🔧 needs work Merge Conflicts. PR has merge time conflicts, update your local branch and then re commit with updated changes. quality: ✅ passed SSoC26 Program label for Social Summer of Code Season 5.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Refactor repeated email validation into a reusable utility

2 participants