-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Bugfix: hide password on shortcuts #2464
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
base: main
Are you sure you want to change the base?
Bugfix: hide password on shortcuts #2464
Conversation
📝 WalkthroughWalkthroughAdds paste-hide behavior and a window blur effect to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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: 2
🧹 Nitpick comments (1)
libs/hooks/src/hooks/use-password-toggle.ts (1)
43-55: Consider extracting password hiding logic to reduce duplication.The password hiding logic (lines 46-48) is duplicated in three places: the Ctrl+V handler (lines 13-15), the Control keyup handler (lines 30-32), and this blur handler. Extracting this to a helper function would improve maintainability.
Example refactor:
const hidePassword = () => { formRef.current ?.querySelector<HTMLInputElement>('input[name="password"]') ?.setAttribute("type", "password"); };Then use
hidePassword()in all three locations. This would also make the blur handler more concise:// Hide Password when losing focus (e.g. unlocking password manager) useEffect(() => { window.addEventListener("blur", hidePassword); return () => { window.removeEventListener("blur", hidePassword); }; }, [formRef]);Note: The helper would need to be defined inside the hook to access
formRef, or accept it as a parameter.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Bugfix
Ctrl+VCtrl+Shift+Lfor Bitwarden), which opens a new window to unlock the password manager, the password is not hidden again, as theControlkeyup event is not send to the login pageExpected Behavior
Password should only be visible when the user intentionally holds down a modifier key for quick inspection, and should never remain visible longer than intended.
Fixes
type="password"Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.