Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Get string and analyze it.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jessgusclark committed May 11, 2021
1 parent 28258f1 commit 04eacf1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/common/passcode/passcode.modal.verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 04eacf1

Please sign in to comment.