-
Notifications
You must be signed in to change notification settings - Fork 41
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
Trim passwords input #589
Trim passwords input #589
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
apps/router/src/guardian-ui/components/setup/screens/setConfiguration/ConfirmPasswordModal.tsxOops! Something went wrong! :( ESLint: 8.40.0 Error: Cannot read config file: /apps/router/.eslintrc.js
📝 WalkthroughWalkthroughThe pull request introduces two new custom hooks, Changes
Sequence DiagramsequenceDiagram
participant User
participant Component
participant useTrimmedInput
User->>Component: Enter input
Component->>useTrimmedInput: Trigger handleChange
useTrimmedInput-->>useTrimmedInput: Trim whitespace
useTrimmedInput->>Component: Update state with cleaned input
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🔇 Additional comments (10)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
apps/router/src/guardian-ui/components/setup/screens/setConfiguration/ConfirmPasswordModal.tsxOops! Something went wrong! :( ESLint: 8.40.0 Error: Cannot read config file: /apps/router/.eslintrc.js
📝 WalkthroughWalkthroughThe pull request introduces two new custom React hooks, Changes
Sequence DiagramsequenceDiagram
participant User
participant Input
participant useTrimmedInput
participant Component
User->>Input: Enters text with whitespace
Input->>useTrimmedInput: Trigger handleChange
useTrimmedInput-->>useTrimmedInput: Trim whitespace
useTrimmedInput->>Component: Update state with trimmed value
Component->>User: Display clean input
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/router/src/guardian-ui/components/setup/screens/setConfiguration/ConfirmPasswordModal.tsx
(3 hunks)apps/router/src/guardian-ui/components/setup/screens/verifyGuardians/VerifyGuardians.tsx
(5 hunks)apps/router/src/hooks/custom/useTrimmedInput.tsx
(1 hunks)apps/router/src/hooks/index.tsx
(1 hunks)
🔇 Additional comments (3)
apps/router/src/hooks/index.tsx (1)
6-6
: Looks good.
No issues detected with this additional export statement.apps/router/src/hooks/custom/useTrimmedInput.tsx (1)
1-27
: Implementation appears solid.
All logic is correct, and whitespace trimming is properly handled.apps/router/src/guardian-ui/components/setup/screens/setConfiguration/ConfirmPasswordModal.tsx (1)
42-43
: Correct usage of custom hook.
No problems found with the trimmed input for password confirmation.
// Prefill hashes if already verified | ||
if ( | ||
peers[ourCurrentId].status === GuardianServerStatus.VerifiedConfigs | ||
) { | ||
const otherPeers = Object.entries(peers).filter( | ||
([id]) => id !== ourCurrentId.toString() | ||
); | ||
setEnteredHashes( | ||
otherPeers.map(([id]) => hashes[id as unknown as number]) | ||
); | ||
otherPeers.forEach(([id], idx) => { | ||
handleHashChange(idx, hashes[id as unknown as number]); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible mismatch in array indexing.
Relying on Object.entries(peers)
order to match the array order in peersWithHash
may fail if the iteration order differs.
Thanks,@alexlwn123! I'm glad the PR has been merged. It's always a pleasure to contribute to the project. |
Issue #573
Implementation Summary
Objective: Improve input handling by trimming unnecessary whitespace from passwords and guardian names during confirmation, enhancing user experience and reducing errors.
Key Changes
useTrimmedInput.tsx
: TheuseTrimmedInput
hook was reused and adapted to handle password inputs, ensuring that whitespace is trimmed automatically to reduce validation errors.Features
UI Implementation
useState
) lacked automatic trimming.useTrimmedInput
automatically sanitizes inputs, simplifying validation and enhancing usability.trim-password-input.mp4