Add warning to confirm fields when values don't match

This commit is contained in:
Dain Nilsson 2024-03-07 09:38:38 +01:00
parent a397ce3215
commit 7942916df5
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
9 changed files with 34 additions and 1 deletions

View File

@ -184,6 +184,11 @@ class _FidoPinDialogState extends ConsumerState<FidoPinDialog> {
_isObscureConfirm ? l10n.s_show_pin : l10n.s_hide_pin, _isObscureConfirm ? l10n.s_show_pin : l10n.s_hide_pin,
), ),
enabled: !_isBlocked && currentPinLenOk && newPinLenOk, enabled: !_isBlocked && currentPinLenOk && newPinLenOk,
errorText: _newPin.length == _confirmPin.length &&
_newPin != _confirmPin
? l10n.l_pin_mismatch
: null,
helperText: '', // Prevents resizing when errorText shown
), ),
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {

View File

@ -233,6 +233,8 @@
"s_confirm_pin": "PIN bestätigen", "s_confirm_pin": "PIN bestätigen",
"s_confirm_puk": null, "s_confirm_puk": null,
"s_unblock_pin": null, "s_unblock_pin": null,
"l_pin_mismatch": null,
"l_puk_mismatch": null,
"l_new_pin_len": "Neue PIN muss mindestens {length} Zeichen lang sein", "l_new_pin_len": "Neue PIN muss mindestens {length} Zeichen lang sein",
"@l_new_pin_len": { "@l_new_pin_len": {
"placeholders": { "placeholders": {
@ -309,6 +311,7 @@
"s_new_password": "Neues Passwort", "s_new_password": "Neues Passwort",
"s_current_password": "Aktuelles Passwort", "s_current_password": "Aktuelles Passwort",
"s_confirm_password": "Passwort bestätigen", "s_confirm_password": "Passwort bestätigen",
"l_password_mismatch": null,
"s_wrong_password": "Falsches Passwort", "s_wrong_password": "Falsches Passwort",
"s_remove_password": "Passwort entfernen", "s_remove_password": "Passwort entfernen",
"s_password_removed": "Passwort entfernt", "s_password_removed": "Passwort entfernt",

View File

@ -233,6 +233,8 @@
"s_confirm_pin": "Confirm PIN", "s_confirm_pin": "Confirm PIN",
"s_confirm_puk": "Confirm PUK", "s_confirm_puk": "Confirm PUK",
"s_unblock_pin": "Unblock PIN", "s_unblock_pin": "Unblock PIN",
"l_pin_mismatch": "PINs do not match",
"l_puk_mismatch": "PUKs do not match",
"l_new_pin_len": "New PIN must be at least {length} characters", "l_new_pin_len": "New PIN must be at least {length} characters",
"@l_new_pin_len": { "@l_new_pin_len": {
"placeholders": { "placeholders": {
@ -309,6 +311,7 @@
"s_new_password": "New password", "s_new_password": "New password",
"s_current_password": "Current password", "s_current_password": "Current password",
"s_confirm_password": "Confirm password", "s_confirm_password": "Confirm password",
"l_password_mismatch": "Passwords do not match",
"s_wrong_password": "Wrong password", "s_wrong_password": "Wrong password",
"s_remove_password": "Remove password", "s_remove_password": "Remove password",
"s_password_removed": "Password removed", "s_password_removed": "Password removed",

View File

@ -233,6 +233,8 @@
"s_confirm_pin": "Confirmez le PIN", "s_confirm_pin": "Confirmez le PIN",
"s_confirm_puk": "Confirmez le PUK", "s_confirm_puk": "Confirmez le PUK",
"s_unblock_pin": "Débloquer le PIN", "s_unblock_pin": "Débloquer le PIN",
"l_pin_mismatch": null,
"l_puk_mismatch": null,
"l_new_pin_len": "Le nouveau PIN doit avoir au moins {length} caractères", "l_new_pin_len": "Le nouveau PIN doit avoir au moins {length} caractères",
"@l_new_pin_len": { "@l_new_pin_len": {
"placeholders": { "placeholders": {
@ -309,6 +311,7 @@
"s_new_password": "Nouveau mot de passe", "s_new_password": "Nouveau mot de passe",
"s_current_password": "Mot de passe actuel", "s_current_password": "Mot de passe actuel",
"s_confirm_password": "Confirmez le mot de passe", "s_confirm_password": "Confirmez le mot de passe",
"l_password_mismatch": null,
"s_wrong_password": "Mauvais mot de passe", "s_wrong_password": "Mauvais mot de passe",
"s_remove_password": "Supprimer le mot de passe", "s_remove_password": "Supprimer le mot de passe",
"s_password_removed": "Mot de passe supprimé", "s_password_removed": "Mot de passe supprimé",

View File

@ -233,6 +233,8 @@
"s_confirm_pin": "PINの確認", "s_confirm_pin": "PINの確認",
"s_confirm_puk": "PUKの確認", "s_confirm_puk": "PUKの確認",
"s_unblock_pin": "ブロックを解除", "s_unblock_pin": "ブロックを解除",
"l_pin_mismatch": null,
"l_puk_mismatch": null,
"l_new_pin_len": "新しいPINは少なくとも{length}文字である必要があります", "l_new_pin_len": "新しいPINは少なくとも{length}文字である必要があります",
"@l_new_pin_len": { "@l_new_pin_len": {
"placeholders": { "placeholders": {
@ -309,6 +311,7 @@
"s_new_password": "新しいパスワード", "s_new_password": "新しいパスワード",
"s_current_password": "現在のパスワード", "s_current_password": "現在のパスワード",
"s_confirm_password": "パスワードを確認", "s_confirm_password": "パスワードを確認",
"l_password_mismatch": null,
"s_wrong_password": "間違ったパスワード", "s_wrong_password": "間違ったパスワード",
"s_remove_password": "パスワードの削除", "s_remove_password": "パスワードの削除",
"s_password_removed": "パスワードが削除されました", "s_password_removed": "パスワードが削除されました",

View File

@ -233,6 +233,8 @@
"s_confirm_pin": "Potwierdź PIN", "s_confirm_pin": "Potwierdź PIN",
"s_confirm_puk": "Potwierdź PUK", "s_confirm_puk": "Potwierdź PUK",
"s_unblock_pin": "Odblokuj PIN", "s_unblock_pin": "Odblokuj PIN",
"l_pin_mismatch": null,
"l_puk_mismatch": null,
"l_new_pin_len": "Nowy PIN musi mieć co najmniej {length} znaków", "l_new_pin_len": "Nowy PIN musi mieć co najmniej {length} znaków",
"@l_new_pin_len": { "@l_new_pin_len": {
"placeholders": { "placeholders": {
@ -309,6 +311,7 @@
"s_new_password": "Nowe hasło", "s_new_password": "Nowe hasło",
"s_current_password": "Aktualne hasło", "s_current_password": "Aktualne hasło",
"s_confirm_password": "Potwierdź hasło", "s_confirm_password": "Potwierdź hasło",
"l_password_mismatch": null,
"s_wrong_password": "Błędne hasło", "s_wrong_password": "Błędne hasło",
"s_remove_password": "Usuń hasło", "s_remove_password": "Usuń hasło",
"s_password_removed": "Hasło zostało usunięte", "s_password_removed": "Hasło zostało usunięte",

View File

@ -251,6 +251,11 @@ class _ManagePasswordDialogState extends ConsumerState<ManagePasswordDialog> {
enabled: (!widget.state.hasKey || enabled: (!widget.state.hasKey ||
_currentPasswordController.text.isNotEmpty) && _currentPasswordController.text.isNotEmpty) &&
_newPassword.isNotEmpty, _newPassword.isNotEmpty,
errorText: _newPassword.length == _confirmPassword.length &&
_newPassword != _confirmPassword
? l10n.l_password_mismatch
: null,
helperText: '', // Prevents resizing when errorText shown
), ),
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
onChanged: (value) { onChanged: (value) {

View File

@ -147,7 +147,8 @@ class _UnlockFormState extends ConsumerState<UnlockForm> {
key: keys.unlockButton, key: keys.unlockButton,
label: Text(l10n.s_unlock), label: Text(l10n.s_unlock),
icon: const Icon(Symbols.lock_open), icon: const Icon(Symbols.lock_open),
onPressed: _passwordController.text.isNotEmpty onPressed: _passwordController.text.isNotEmpty &&
!_passwordIsWrong
? _submit ? _submit
: null, : null,
), ),

View File

@ -274,6 +274,13 @@ class _ManagePinPukDialogState extends ConsumerState<ManagePinPukDialog> {
: (_isObscureConfirm ? l10n.s_show_puk : l10n.s_hide_puk), : (_isObscureConfirm ? l10n.s_show_puk : l10n.s_hide_puk),
), ),
enabled: currentPin.length >= _minPinLen && _newPin.length >= 6, enabled: currentPin.length >= _minPinLen && _newPin.length >= 6,
errorText: _newPin.length == _confirmPin.length &&
_newPin != _confirmPin
? (widget.target == ManageTarget.pin
? l10n.l_pin_mismatch
: l10n.l_puk_mismatch)
: null,
helperText: '', // Prevents resizing when errorText shown
), ),
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
onChanged: (value) { onChanged: (value) {