Skip to content

Comments

feat: improve password error message#7842

Merged
LucasXu0 merged 4 commits intoAppFlowy-IO:mainfrom
LucasXu0:password_error_message
Apr 28, 2025
Merged

feat: improve password error message#7842
LucasXu0 merged 4 commits intoAppFlowy-IO:mainfrom
LucasXu0:password_error_message

Conversation

@LucasXu0
Copy link
Collaborator

@LucasXu0 LucasXu0 commented Apr 28, 2025

Feature Preview

  • improve password error message
  • bump client-api version

PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Refactor password error handling to provide more specific feedback and update backend client dependencies.

Enhancements:

  • Display specific password validation errors directly within the input fields.
  • Centralize password error message parsing and localization logic.

Build:

  • Update client-api, client-api-entity, and workspace-template dependencies to a newer revision.

Chores:

  • Adjust layout alignment in the account deletion section.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Apr 28, 2025

Reviewer's Guide by Sourcery

This pull request improves the handling and display of password-related error messages in the settings screens by introducing a dedicated utility class. It parses backend error strings using regular expressions and displays specific, localized messages directly on the relevant input fields. Additionally, it updates the client-api dependency.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Introduce a new utility class for handling password error messages.
  • Define regular expression patterns for common password errors like incorrect password, too short, and too long.
  • Implement a static method to map backend error messages to localized strings based on matching patterns.
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/password/error_extensions.dart
Refactor password change dialog to use the new error handling utility.
  • Import the new error extension class.
  • Replace direct string containment checks with regex pattern matching from the utility.
  • Use the utility class to retrieve localized error messages.
  • Simplify toast notification and dialog closing logic.
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/password/change_password.dart
Refactor password setup dialog to use the new error handling utility.
  • Import the new error extension class.
  • Replace direct string containment checks with regex pattern matching from the utility.
  • Use the utility class to retrieve localized error messages and set them as input field errors.
  • Simplify toast notification logic for errors.
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/password/setup_password.dart
Update client-api dependency version.
  • Bump the revision hash for client-api, client-api-entity, and workspace-template dependencies in Cargo.toml.
  • Update Cargo.lock accordingly.
frontend/rust-lib/Cargo.toml
frontend/rust-lib/Cargo.lock
Minor UI adjustment in account deletion screen.
  • Remove unused crossAxisAlignment property from a Row widget.
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/account_deletion.dart
Update localization files with new password error messages.
  • Add or modify translation keys related to the new password error messages.
frontend/resources/translations/en.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link

github-actions bot commented Apr 28, 2025

🥷 Ninja i18n – 🛎️ Translations need to be updated

Project /project.inlang

lint rule new reports level link
Missing translation 29 warning contribute (via Fink 🐦)

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @LucasXu0 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider refactoring the repeated error pattern matching logic within the UI components to reduce duplication.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@LucasXu0 LucasXu0 merged commit 2661ad2 into AppFlowy-IO:main Apr 28, 2025
19 of 20 checks passed
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.

1 participant