summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Schweizer <sebastian@schweizer.tel>2017-06-22 11:57:27 +0200
committerSebastian Schweizer <sebastian@schweizer.tel>2017-06-22 11:57:27 +0200
commit1ce103e42170e86910af23e3529e76bdeb59f5a8 (patch)
tree4715a9fc40cbfa221a4d5b414933e0784c317506
parenta0687e511e9cba96c41abd086fe3f322dddf6a67 (diff)
downloadgoogle2fa-1ce103e42170e86910af23e3529e76bdeb59f5a8.zip
google2fa-1ce103e42170e86910af23e3529e76bdeb59f5a8.tar.gz
google2fa-1ce103e42170e86910af23e3529e76bdeb59f5a8.tar.bz2
fix null timestamp issue in verifyKeyNewer
-rw-r--r--src/Google2FA.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Google2FA.php b/src/Google2FA.php
index f66e4aa..2f752b2 100644
--- a/src/Google2FA.php
+++ b/src/Google2FA.php
@@ -350,8 +350,10 @@ class Google2FA
*/
public function verifyKey($secret, $key, $window = null, $timestamp = null, $oldTimestamp = '__not_set__')
{
+ $timestamp = $this->makeTimestamp($timestamp);
+
$startingTimestamp = $oldTimestamp === '__not_set__'
- ? ($timestamp = $this->makeTimestamp($timestamp)) - $this->getWindow($window)
+ ? $timestamp - $this->getWindow($window)
: max($timestamp - $this->getWindow($window), $oldTimestamp + 1);
return $this->findValidOTP(