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