Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 63fd9ac

Browse files
committed
Make isCorrectPin consitent with unlockWithPin
1 parent 10c42dc commit 63fd9ac

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/src/entities/authenticator_impl.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,21 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator {
302302

303303
@override
304304
Future<bool> isCorrectPin({required Pin pin}) async {
305+
final isEnabled = await isPinAuthenticationEnabled();
306+
if (!isEnabled) {
307+
return true;
308+
}
309+
if (await _isLockedDueToTooManyAttempts()) {
310+
return false;
311+
}
312+
305313
final userPin = await _repository.getPin(forUser: userId);
306314
if (userPin?.value != pin.value) {
315+
await _repository.addFailedAttempt(DateTime.now(), forUser: userId);
307316
return false;
308317
}
318+
await _repository.resetFailedAttempts(ofUser: userId);
319+
_repository.clearLastPausedTimestamp();
309320
return true;
310321
}
311322

0 commit comments

Comments
 (0)