Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #11315 from pauljt/bug888911
Browse files Browse the repository at this point in the history
Bug 888911 -  Implement an increasing lockout delay to prevent passcode
  • Loading branch information
rvandermeulen committed Aug 16, 2013
2 parents 4c57c9b + 4b62347 commit 28a93e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apps/system/js/lockscreen.js
Expand Up @@ -74,6 +74,11 @@ var LockScreen = {
*/
kPassCodeErrorTimeout: 500,

/*
* Counter after incorrect attempt
*/
kPassCodeErrorCounter: 0,

/*
* Airplane mode
*/
Expand Down Expand Up @@ -982,6 +987,8 @@ var LockScreen = {
var self = this;
this.overlay.dataset.passcodeStatus = 'success';
this.passCodeError = 0;
this.kPassCodeErrorTimeout = 500;
this.kPassCodeErrorCounter = 0;

var transitionend = function() {
self.passcodeCode.removeEventListener('transitionend', transitionend);
Expand All @@ -990,6 +997,11 @@ var LockScreen = {
this.passcodeCode.addEventListener('transitionend', transitionend);
} else {
this.overlay.dataset.passcodeStatus = 'error';
this.kPassCodeErrorCounter++;
//double delay if >5 failed attempts
if (this.kPassCodeErrorCounter > 5) {
this.kPassCodeErrorTimeout = 2 * this.kPassCodeErrorTimeout;
}
if ('vibrate' in navigator)
navigator.vibrate([50, 50, 50]);

Expand Down

0 comments on commit 28a93e5

Please sign in to comment.