mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-26 10:33:15 +03:00
Only allow shorter FIDO PIN when changing PIN, if forcePinChange
This commit is contained in:
parent
3245c0d637
commit
442714ac29
@ -69,8 +69,12 @@ class _FidoPinDialogState extends ConsumerState<FidoPinDialog> {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final hasPin = widget.state.hasPin;
|
||||
final minPinLength = widget.state.minPinLength;
|
||||
// N.B. current PIN may be shorter than minimum, if it was set before the minimum was increased
|
||||
final currentPinLenOk = !hasPin || _currentPinController.text.length >= 4;
|
||||
final currentMinPinLen = !hasPin
|
||||
? 0
|
||||
// N.B. current PIN may be shorter than minimum if set before the minimum was increased
|
||||
: (widget.state.forcePinChange ? 4 : widget.state.minPinLength);
|
||||
final currentPinLenOk =
|
||||
_currentPinController.text.length >= currentMinPinLen;
|
||||
final newPinLenOk = _newPin.length >= minPinLength;
|
||||
final isValid = currentPinLenOk && newPinLenOk && _newPin == _confirmPin;
|
||||
|
||||
|
@ -148,10 +148,12 @@ class _PinEntryFormState extends ConsumerState<PinEntryForm> {
|
||||
key: unlockFido2WithPin,
|
||||
icon: const Icon(Symbols.lock_open),
|
||||
label: Text(l10n.s_unlock),
|
||||
onPressed:
|
||||
!_pinIsWrong && _pinController.text.length >= 4 && !_blocked
|
||||
? _submit
|
||||
: null,
|
||||
onPressed: !_pinIsWrong &&
|
||||
_pinController.text.length >=
|
||||
widget._state.minPinLength &&
|
||||
!_blocked
|
||||
? _submit
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user