From 04eacf1f186f23dd3a75c200a54e5d2b7b3294d9 Mon Sep 17 00:00:00 2001 From: Jesse Clark Date: Tue, 11 May 2021 18:42:57 +0300 Subject: [PATCH] Get string and analyze it. - Get the string from storage first, if it is '0' or false, then the user is good and return. - This is a similar approach that is taken a few lines up under wrongAttemptsStorage --- src/components/common/passcode/passcode.modal.verify.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/common/passcode/passcode.modal.verify.js b/src/components/common/passcode/passcode.modal.verify.js index 09d40329..bc1d8162 100644 --- a/src/components/common/passcode/passcode.modal.verify.js +++ b/src/components/common/passcode/passcode.modal.verify.js @@ -43,7 +43,12 @@ class VerifyPasscodeModal extends PureComponent { if (this.wrongAttemptsCounter < WRONG_ATTEMPTS_STEPS.step1.maxAttempts) { return; } - const lastAttemptTimestamp = parseInt(await storage.getLastPasscodeAttempt(), 10); + const lastPasscodeStorage = await storage.getLastPasscodeAttempt(); + if (!lastPasscodeStorage || lastPasscodeStorage === '0') { + return; + } + + const lastAttemptTimestamp = parseInt(lastPasscodeStorage, 10); const msSinceLastAttempt = Date.now() - lastAttemptTimestamp; const { waitingMinutes } = getClosestStep({ numberOfAttempts: this.wrongAttemptsCounter }); const milliseconds = waitingMinutes * 1000 * 60 - msSinceLastAttempt;