Skip to content

Fix password mismatch flash in authentication#818

Open
nicksan222 wants to merge 2 commits into
l3montree-dev:mainfrom
nicksan222:fix/password-mismatch-flash
Open

Fix password mismatch flash in authentication#818
nicksan222 wants to merge 2 commits into
l3montree-dev:mainfrom
nicksan222:fix/password-mismatch-flash

Conversation

@nicksan222

Copy link
Copy Markdown
Contributor

This pull request refactors the password mismatch logic to improve code organization and testability. The core logic for detecting password mismatches has been moved from the UI component into a dedicated hook in the src/hooks directory, and comprehensive unit tests have been added to ensure correct behavior. Minor import adjustments were made to accommodate this change, and a small test assertion was added to the end-to-end tests.

This fixes l3montree-dev/devguard#2117

Copilot AI review requested due to automatic review settings July 12, 2026 13:26

Copilot AI 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.

Pull request overview

This PR addresses the “passwords do not match” flash during Ory authentication flows by moving password mismatch detection out of UI components into a dedicated React Hook Form-based hook, and updating affected UI + tests accordingly (related to issue #2117).

Changes:

  • Introduces usePasswordMismatch hook to centralize mismatch detection and handle the “Ory clears password after submit” case.
  • Updates Ory flow components to import and use the new hook instead of an inline implementation.
  • Adds unit tests for the hook and extends an e2e test with an assertion about the mismatch message.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/hooks/usePasswordMismatch.ts New hook encapsulating password mismatch detection logic.
src/hooks/usePasswordMismatch.test.tsx Unit tests covering mismatch behavior and the “password cleared” scenario.
src/components/ory/flowcomponents/PasswordField.tsx Removes the previously inlined usePasswordMismatch implementation.
src/components/ory/flowcomponents/Nodes/OryRegistrationInput.tsx Switches to importing the hook from src/hooks.
src/components/ory/flowcomponents/Nodes/OryButton.tsx Switches to importing the hook from src/hooks for submit disabling logic.
e2e/src/devguard-login-flow.e2e.spec.ts Adds an assertion intended to ensure the mismatch message doesn’t appear.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread e2e/src/devguard-login-flow.e2e.spec.ts
Comment thread src/hooks/usePasswordMismatch.ts Outdated
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.

"Passwords do not match" Validation Error Flashes Briefly Before Successful Sign Up

2 participants