Skip to content

Commit b151f3c

Browse files
committed
fix existing tokens call
1 parent 482361e commit b151f3c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/User.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ private static function generateTokenCode() {
1111
self::cleanupTokens();
1212
$existingTokens = self::getExistingVerifyTokens();
1313

14+
$code = random_int(0,1000000);
15+
$code = str_pad($code, $digits, '0', STR_PAD_LEFT);
16+
1417
while (in_array($code, $existingTokens)) { // make sure we have no collissions;
1518
$code = random_int(0,1000000);
1619
$code = str_pad($code, $digits, '0', STR_PAD_LEFT);
1720
}
1821

19-
$code = random_int(0,1000000);
20-
$code = str_pad($code, $digits, '0', STR_PAD_LEFT);
2122
return $code;
2223
}
2324

@@ -346,7 +347,8 @@ public static function getExistingVerifyTokens() {
346347
$query = Db::$pdo->prepare(
347348
'SELECT code FROM verify'
348349
);
349-
$existingTokens = $query->execute();
350+
$query->execute();
351+
$existingTokens = $query->fetchAll();
350352
return $existingTokens;
351353
}
352354
}

0 commit comments

Comments
 (0)