Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow emails finishing with .school #185

Merged
merged 2 commits into from
Feb 6, 2025
Merged

Allow emails finishing with .school #185

merged 2 commits into from
Feb 6, 2025

Conversation

FlavioF
Copy link
Contributor

@FlavioF FlavioF commented Feb 6, 2025

PR Type

Bug fix, Enhancement


Description

  • Updated email validation regex to allow .school domains.

  • Bumped package version from 0.1.89 to 0.1.90.


Changes walkthrough 📝

Relevant files
Bug fix
isValidEmail.ts
Update email validation regex for extended domains             

src/molecules/question/helpers/isValidEmail.ts

  • Modified the email validation regex to support domains with more than
    4 characters.
  • Ensures .school and similar domains are considered valid.
  • +1/-1     
    Configuration changes
    package.json
    Bump package version to 0.1.90                                                     

    package.json

    • Updated the package version from 0.1.89 to 0.1.90.
    +1/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    github-actions bot commented Feb 6, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Regex Validation Update

    The updated regex now allows domains with more than 4 characters (e.g., .school). Ensure this change does not unintentionally allow invalid email formats or domains.

    const emailRegex = /^[\w-+.]+@([\w-]+\.)+[\w-]{2,}$/

    Copy link

    github-actions bot commented Feb 6, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Improve regex to handle edge cases

    Ensure the updated regex accounts for edge cases like emails with consecutive dots
    or invalid characters before the '@' symbol, as these could bypass validation.

    src/molecules/question/helpers/isValidEmail.ts [3]

    -const emailRegex = /^[\w-+.]+@([\w-]+\.)+[\w-]{2,}$/
    +const emailRegex = /^(?!.*\.\.)[\w-+.]+@([\w-]+\.)+[\w-]{2,}$/
    Suggestion importance[1-10]: 9

    __

    Why: The suggestion improves the regex by addressing potential edge cases like consecutive dots in the email or invalid characters before the '@' symbol, which enhances the robustness of the email validation function. This is a significant improvement in functionality and correctness.

    High

    @FlavioF FlavioF merged commit 728074a into main Feb 6, 2025
    7 checks passed
    @FlavioF FlavioF deleted the patch-email-version branch February 6, 2025 14:42
    # for free to join this conversation on GitHub. Already have an account? # to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant