Fix password mismatch flash in authentication#818
Open
nicksan222 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
usePasswordMismatchhook 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/hooksdirectory, 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