Skip to content

Commit 82eb26d

Browse files
feat(settings): add password meter (#1299)
## What? Adds real-time password feedback to the encryption settings screen. - Shows whether the password and confirmation fields match while typing. - Shows an informational password strength level: `weak`, `medium`, or `strong`. - Adds `internal/passwordstrength` with a `Meter` interface and a `LibMeter` implementation backed by `github.com/wagslane/go-password-validator`. ## Why? Closes #628 Users previously only learned that password confirmation failed after submitting the form. Inline feedback makes the encryption setup flow clearer and helps users catch mistakes before attempting to enable encryption. The strength meter is informational only: weak passwords are not rejected. --------- Co-authored-by: Andriy Chernov <andriy@floatpane.com>
1 parent 294bed4 commit 82eb26d

17 files changed

Lines changed: 166 additions & 7 deletions

File tree

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ require (
2424
github.com/hashicorp/golang-lru/v2 v2.0.7
2525
github.com/knadh/go-pop3 v1.0.2
2626
github.com/mattn/go-sixel v0.0.9
27+
github.com/wagslane/go-password-validator v0.3.0
2728
github.com/yuin/goldmark v1.8.2
2829
github.com/yuin/gopher-lua v1.1.2
2930
github.com/zalando/go-keyring v0.2.8

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
103103
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
104104
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
105105
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
106+
github.com/wagslane/go-password-validator v0.3.0 h1:vfxOPzGHkz5S146HDpavl0cw1DSVP061Ry2PX0/ON6I=
107+
github.com/wagslane/go-password-validator v0.3.0/go.mod h1:TI1XJ6T5fRdRnHqHt14pvy1tNVnrwe7m3/f1f2fDphQ=
106108
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
107109
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
108110
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=

i18n/locales/ar.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@
174174
"disable_confirm": "تعطيل التشفير؟",
175175
"disable_warning": "سيتم تخزين جميع البيانات بدون تشفير.",
176176
"encrypting": "جاري تشفير البيانات...",
177+
"passwords_match": "✓ كلمات المرور متطابقة",
178+
"passwords_do_not_match": "✗ كلمات المرور غير متطابقة",
179+
"strength_label": "القوة:",
180+
"strength_weak": "ضعيف",
181+
"strength_medium": "متوسط",
182+
"strength_strong": "قوي",
177183
"error_empty": "لا يمكن أن تكون كلمة المرور فارغة",
178184
"error_mismatch": "كلمات المرور غير متطابقة",
179185
"help": "tab: التالي • enter: حفظ"

i18n/locales/de.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@
170170
"disable_confirm": "Verschlüsselung deaktivieren?",
171171
"disable_warning": "Alle Daten werden unverschlüsselt gespeichert.",
172172
"encrypting": "Daten werden verschlüsselt...",
173+
"passwords_match": "✓ Passwörter stimmen überein",
174+
"passwords_do_not_match": "✗ Passwörter stimmen nicht überein",
175+
"strength_label": "Stärke:",
176+
"strength_weak": "schwach",
177+
"strength_medium": "mittel",
178+
"strength_strong": "stark",
173179
"error_empty": "Passwort darf nicht leer sein",
174180
"error_mismatch": "Passwörter stimmen nicht überein",
175181
"help": "tab: nächstes • enter: speichern"

i18n/locales/en.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@
170170
"disable_confirm": "Disable encryption?",
171171
"disable_warning": "All data will be stored unencrypted.",
172172
"encrypting": "Encrypting data...",
173+
"passwords_match": "✓ Passwords match",
174+
"passwords_do_not_match": "✗ Passwords do not match",
175+
"strength_label": "Strength:",
176+
"strength_weak": "weak",
177+
"strength_medium": "medium",
178+
"strength_strong": "strong",
173179
"error_empty": "Password cannot be empty",
174180
"error_mismatch": "Passwords do not match",
175181
"help": "tab: next • enter: save"

i18n/locales/es.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@
170170
"disable_confirm": "¿Deshabilitar cifrado?",
171171
"disable_warning": "Todos los datos se almacenarán sin cifrar.",
172172
"encrypting": "Cifrando datos...",
173+
"passwords_match": "✓ Las contraseñas coinciden",
174+
"passwords_do_not_match": "✗ Las contraseñas no coinciden",
175+
"strength_label": "Fortaleza:",
176+
"strength_weak": "débil",
177+
"strength_medium": "media",
178+
"strength_strong": "fuerte",
173179
"error_empty": "La contraseña no puede estar vacía",
174180
"error_mismatch": "Las contraseñas no coinciden",
175181
"help": "tab: siguiente • enter: guardar"

i18n/locales/fr.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@
170170
"disable_confirm": "Désactiver le chiffrement ?",
171171
"disable_warning": "Toutes les données seront stockées non chiffrées.",
172172
"encrypting": "Chiffrement des données...",
173+
"passwords_match": "✓ Les mots de passe correspondent",
174+
"passwords_do_not_match": "✗ Les mots de passe ne correspondent pas",
175+
"strength_label": "Force :",
176+
"strength_weak": "faible",
177+
"strength_medium": "moyen",
178+
"strength_strong": "fort",
173179
"error_empty": "Le mot de passe ne peut pas être vide",
174180
"error_mismatch": "Les mots de passe ne correspondent pas",
175181
"help": "tab: suivant • entrée: enregistrer"

i18n/locales/ja.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@
168168
"disable_confirm": "暗号化を無効にしますか?",
169169
"disable_warning": "すべてのデータは暗号化されずに保存されます。",
170170
"encrypting": "データを暗号化中...",
171+
"passwords_match": "✓ パスワードが一致しました",
172+
"passwords_do_not_match": "✗ パスワードが一致しません",
173+
"strength_label": "強度:",
174+
"strength_weak": "弱い",
175+
"strength_medium": "普通",
176+
"strength_strong": "強い",
171177
"error_empty": "パスワードを空にすることはできません",
172178
"error_mismatch": "パスワードが一致しません",
173179
"help": "tab: 次へ • enter: 保存"

i18n/locales/pl.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@
174174
"disable_confirm": "Wyłączyć szyfrowanie?",
175175
"disable_warning": "Wszystkie dane będą przechowywane bez szyfrowania.",
176176
"encrypting": "Szyfrowanie danych...",
177+
"passwords_match": "✓ Hasła pasują do siebie",
178+
"passwords_do_not_match": "✗ Hasła nie pasują do siebie",
179+
"strength_label": "Siła:",
180+
"strength_weak": "słabe",
181+
"strength_medium": "średnie",
182+
"strength_strong": "silne",
177183
"error_empty": "Hasło nie może być puste",
178184
"error_mismatch": "Hasła nie pasują do siebie",
179185
"help": "tab: następny • enter: zapisz"

i18n/locales/pt.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@
170170
"disable_confirm": "Desativar criptografia?",
171171
"disable_warning": "Todos os dados serão armazenados sem criptografia.",
172172
"encrypting": "Criptografando dados...",
173+
"passwords_match": "✓ As senhas coincidem",
174+
"passwords_do_not_match": "✗ As senhas não coincidem",
175+
"strength_label": "Força:",
176+
"strength_weak": "fraca",
177+
"strength_medium": "média",
178+
"strength_strong": "forte",
173179
"error_empty": "A senha não pode estar vazia",
174180
"error_mismatch": "As senhas não coincidem",
175181
"help": "tab: próximo • enter: salvar"

0 commit comments

Comments
 (0)