Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Nov 2, 2014
2 parents 9b02af6 + 9cc180b commit 2667ac8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
vendor/
build/
build/
3 changes: 2 additions & 1 deletion lib/HOTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public function verify($otp, $counter, $window = null)
if (!is_integer($window)) {
$window = 0;
}
$window = abs($window);

for ($i=$counter; $i <= $counter+abs($window); $i++) {
for ($i=$counter; $i <= $counter+$window; $i++) {
if ($otp === $this->at($i)) {
$this->updateCounter($i+1);

Expand Down
3 changes: 2 additions & 1 deletion lib/TOTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public function verify($otp, $timestamp = null, $window = null)
if (!is_integer($window)) {
return $otp === $this->at($timestamp);
}
$window = abs($window);

for ($i=-abs($window); $i <= abs($window); $i++) {
for ($i=-$window; $i <= $window; $i++) {
if ($otp === $this->at($i*$this->getInterval()+$timestamp)) {
return true;
}
Expand Down

0 comments on commit 2667ac8

Please sign in to comment.