feat(ui): 安全增强 — 修改密码 / 自动锁定 / HOTP 提示 / 配置备份

- 修改密码对话框引入旧密码校验:通过 store.VerifyPassword 走 constant-time
  比较,对话框自身不持有 live passphrase 副本。
- 配置加密且 auto_lock_minutes>0 时启用自动锁定;明文配置不受影响。
  锁定时刻意保留 store.passphrase,避免解锁瞬间出现保存竞态——进程内存
  无论如何都是威胁边界。
- HOTP 点击后 toast 仅显示推进后的计数器值,绝不携带验证码字符串。
- SaveYAML 每次写入前将旧文件轮转为 .bak(0o600),防止加密/序列化失败
  导致用户无可恢复副本。
- Preferences 对话框新增"自动锁定(分钟)"输入项。
This commit is contained in:
2026-06-12 03:56:41 +08:00
parent fedc198452
commit 0918fd446a
9 changed files with 367 additions and 17 deletions
+29
View File
@@ -419,3 +419,32 @@ other = "MIT"
[about_credits]
other = "Original-WinAuth von Colin Mackie. Go-Portierung wird von den Projektautoren gepflegt."
# --- Sicherheit: Passwort ändern / automatische Sperre / HOTP-Hinweis ---
[menu_change_password]
other = "Passwort ändern..."
[dialog_change_password_title]
other = "Passwort ändern"
[label_password_current]
other = "Aktuelles Passwort"
[label_password_new]
other = "Neues Passwort"
[msg_password_changed]
other = "Passwort geändert."
[msg_hotp_advanced]
other = "Zähler auf %d erhöht"
[msg_locked]
other = "Wegen Inaktivität gesperrt. Passwort zum Entsperren eingeben."
[label_auto_lock_minutes]
other = "Automatisch sperren nach (Minuten)"
[hint_auto_lock_disabled]
other = "0 deaktiviert. Nur wirksam, wenn die Konfiguration verschlüsselt ist."
+29
View File
@@ -421,3 +421,32 @@ other = "MIT"
[about_credits]
other = "Original WinAuth by Colin Mackie. Go port maintained by the project authors."
# --- Security: change password / auto-lock / HOTP toast ---
[menu_change_password]
other = "Change password..."
[dialog_change_password_title]
other = "Change password"
[label_password_current]
other = "Current password"
[label_password_new]
other = "New password"
[msg_password_changed]
other = "Password changed."
[msg_hotp_advanced]
other = "Counter advanced to %d"
[msg_locked]
other = "Locked due to inactivity. Enter the password to unlock."
[label_auto_lock_minutes]
other = "Auto-lock after (minutes)"
[hint_auto_lock_disabled]
other = "Set to 0 to disable. Only takes effect when the configuration is encrypted."
+29
View File
@@ -419,3 +419,32 @@ other = "MIT"
[about_credits]
other = "原版 WinAuth 由 Colin Mackie 创作。Go 移植由本项目作者维护。"
# --- 安全:修改密码 / 自动锁定 / HOTP 提示 ---
[menu_change_password]
other = "修改密码..."
[dialog_change_password_title]
other = "修改密码"
[label_password_current]
other = "当前密码"
[label_password_new]
other = "新密码"
[msg_password_changed]
other = "密码已更新。"
[msg_hotp_advanced]
other = "计数器推进到 %d"
[msg_locked]
other = "因长时间无操作已锁定,请输入密码解锁。"
[label_auto_lock_minutes]
other = "自动锁定(分钟)"
[hint_auto_lock_disabled]
other = "填 0 关闭。仅当配置已加密时生效。"