Don't use hex validation for PIN

This commit is contained in:
Dain Nilsson 2024-03-11 15:26:03 +01:00
parent c66f96016b
commit fdc4c7547e
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -90,12 +90,13 @@ class _ManageKeyDialogState extends ConsumerState<ManageKeyDialog> {
} }
_submit() async { _submit() async {
final currentInvalidFormat = Format.hex.isValid(_currentController.text); final currentValidFormat =
final newInvalidFormat = Format.hex.isValid(_keyController.text); _usesStoredKey || Format.hex.isValid(_currentController.text);
if (!currentInvalidFormat || !newInvalidFormat) { final newValidFormat = Format.hex.isValid(_keyController.text);
if (!currentValidFormat || !newValidFormat) {
setState(() { setState(() {
_currentInvalidFormat = !currentInvalidFormat; _currentInvalidFormat = !currentValidFormat;
_newInvalidFormat = !newInvalidFormat; _newInvalidFormat = !newValidFormat;
}); });
return; return;
} }
@ -202,9 +203,6 @@ class _ManageKeyDialogState extends ConsumerState<ManageKeyDialog> {
helperText: _defaultPinUsed ? l10n.l_default_pin_used : null, helperText: _defaultPinUsed ? l10n.l_default_pin_used : null,
errorText: _currentIsWrong errorText: _currentIsWrong
? l10n.l_wrong_pin_attempts_remaining(_attemptsRemaining) ? l10n.l_wrong_pin_attempts_remaining(_attemptsRemaining)
: _currentInvalidFormat
? l10n.l_invalid_format_allowed_chars(
Format.hex.allowedCharacters)
: null, : null,
errorMaxLines: 3, errorMaxLines: 3,
prefixIcon: const Icon(Symbols.pin), prefixIcon: const Icon(Symbols.pin),