File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments