feat: allow hiding TOTP codes by default (#319) - #323
Open
rootphantomer wants to merge 1 commit into
Open
rootphantomer wants to merge 1 commit into
rootphantomer wants to merge 1 commit into
Conversation
Add a local "Hide verification codes by default" preference under Settings > Appearance. When enabled, TOTP codes on the verification codes page and in the vault item detail are masked with asterisks until revealed via the eye toggle. Copy always copies the real code. The preference is stored in localStorage (defaults to off, so existing behavior is unchanged) and reuses the existing maskSecret + Eye/EyeOff convention. Adds txt_hide_totp_by_default[_help] to all 10 locales.
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.
Summary
Closes #319.
控制面板此前默认以明文显示 TOTP 验证码。本 PR 在「设置 > 外观」下新增一个本地偏好「默认隐藏验证码(Hide verification codes by default)」。开启后,验证码面板和密码项详情中的 TOTP 会用星号遮罩,点击眼睛图标后才显示。复制按钮始终复制真实验证码。
该偏好保存在 localStorage(默认关闭,因此现有行为不变),并复用代码库已有的
maskSecret+ Eye/EyeOff 约定。新增txt_hide_totp_by_default[_help]文案,覆盖全部 10 种语言。涉及的界面:
TotpCodesPage—— 逐条显隐(用Set<string>记录已展开的 cipher ID,参照PasswordSecurityPage的实现)VaultDetailView—— 在showPassword旁新增showTotp状态,切换条目时重置live.code,因此遮罩态下复制得到的仍是当前真实验证码。Change Type
Cross-File Checklist
CONTRIBUTING.md.migrations/0001_init.sql.Checks
npx tsc -p tsconfig.json --noEmitnpx tsc -p webapp/tsconfig.json --noEmitnpm run i18n:validatenpm run buildNotes
nodewarden.totp.hide-by-default.v1),因此不涉及备份/导入导出或数据库。上面两条未勾选的「if any」项即因此属于 N/A;Bitwarden 同步/API 形状完全未改(纯前端改动)。npx tsc -p webapp/tsconfig.json --noEmit未勾选,是因为它在main上就存在 4 个预存错误,且都在本 PR未触及的文件中(
webapp/src/lib/api/backup.ts、webapp/src/lib/backup-center.ts、webapp/src/lib/password-security-cache.ts、webapp/vite.config.ts)。这些错误并非本次改动引入或影响——本次修改的 6个组件文件均类型检查通过。后端tsc、i18n:validate和npm run build全部通过。截图