* Fix a bug that caused timeslices to be returned instead of the intended timeslice

* Upped version
This commit is contained in:
RobThree
2018-06-06 02:32:07 +02:00
parent 72572c5c3a
commit fca87f2d09
4 changed files with 10 additions and 9 deletions
+2 -1
View File
@@ -86,7 +86,8 @@ class TwoFactorAuth
// To keep safe from timing-attachs we iterate *all* possible codes even though we already may have verified a code is correct
for ($i = -$discrepancy; $i <= $discrepancy; $i++) {
$ts = $timetamp + ($i * $this->period);
$timeslice += $this->codeEquals($this->getCode($secret, $ts), $code) ? $ts : 0;
$slice = $this->getTimeSlice($ts);
$timeslice += $this->codeEquals($this->getCode($secret, $ts), $code) ? $slice : 0;
}
return $timeslice > 0;