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

feat: add ADDRESS_REGEX #401

Merged
merged 1 commit into from
Aug 13, 2024
Merged

feat: add ADDRESS_REGEX #401

merged 1 commit into from
Aug 13, 2024

Conversation

dreamhunter2333
Copy link
Owner

@dreamhunter2333 dreamhunter2333 commented Aug 12, 2024

PR Type

Enhancement, Documentation


Description

  • Added dynamic email validation using a configurable regex pattern in both frontend and backend.
  • Updated various components and API responses to include and utilize the new ADDRESS_REGEX configuration.
  • Enhanced documentation to reflect the new ADDRESS_REGEX configuration option.

Changes walkthrough 📝

Relevant files
Enhancement
5 files
Login.vue
Add dynamic email validation using regex                                 

frontend/src/views/common/Login.vue

  • Added addressRegex computed property to handle dynamic regex for email
    validation.
  • Updated email validation logic to use addressRegex.
  • Modified UI text to display allowed characters dynamically.
  • +16/-4   
    commom_api.ts
    Include address regex in settings API response                     

    worker/src/commom_api.ts

    • Added addressRegex to the settings API response.
    +1/-0     
    common.ts
    Add dynamic regex fetching for email name sanitization     

    worker/src/common.ts

  • Added DEFAULT_NAME_REGEX constant.
  • Created getNameRegex function to fetch and compile regex from
    environment.
  • Updated email name sanitization to use getNameRegex.
  • +17/-1   
    types.d.ts
    Update Bindings type with ADDRESS_REGEX                                   

    worker/src/types.d.ts

    • Added ADDRESS_REGEX to Bindings type.
    +1/-0     
    index.js
    Add addressRegex to openSettings state                                     

    frontend/src/store/index.js

    • Added addressRegex to openSettings state.
    +1/-0     
    Documentation
    4 files
    CHANGELOG.md
    Update CHANGELOG for ADDRESS_REGEX configuration                 

    CHANGELOG.md

    • Documented the addition of ADDRESS_REGEX configuration.
    +1/-0     
    cli.md
    Document ADDRESS_REGEX configuration in English CLI guide

    vitepress-docs/docs/en/cli.md

    • Added documentation for ADDRESS_REGEX configuration.
    +2/-0     
    worker.md
    Document ADDRESS_REGEX configuration in Chinese CLI guide

    vitepress-docs/docs/zh/guide/cli/worker.md

    • Added documentation for ADDRESS_REGEX configuration.
    +2/-0     
    wrangler.toml.template
    Add ADDRESS_REGEX configuration example in template           

    worker/wrangler.toml.template

    • Added ADDRESS_REGEX configuration example.
    +2/-0     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 3 labels Aug 12, 2024
    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🔒 No security concerns identified
    ⚡ Key issues to review

    Possible Bug
    The addressRegex computed property does not handle the case where openSettings.value.addressRegex is not a valid regular expression. This could lead to runtime errors. Consider adding a fallback mechanism or validation before using it.

    Possible Bug
    The getNameRegex function does not handle cases where new RegExp(regex, 'g') might throw an error due to invalid regex patterns. This could lead to runtime errors. Consider adding a validation step before creating the RegExp object.

    @dreamhunter2333 dreamhunter2333 merged commit d90f543 into main Aug 13, 2024
    1 check passed
    @dreamhunter2333 dreamhunter2333 deleted the feature/dev branch August 13, 2024 15:21
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 3
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant