diff options
| author | Piotr Pawlow <pp@siedziba.pl> | 2017-03-19 18:20:56 +0100 |
|---|---|---|
| committer | Piotr Pawlow <pp@siedziba.pl> | 2017-03-19 18:20:56 +0100 |
| commit | e75b599b71951cd92b023de2a81bbbed0a965b8f (patch) | |
| tree | adf2af67140e29f3f63fff3da629785eb71543e2 /auth.php | |
| parent | 4251d5f5e46a822b56e8a8c52c2aea53f107065b (diff) | |
Move delay to between getting verification result, and checking the result.
Diffstat (limited to 'auth.php')
| -rw-r--r-- | auth.php | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -23,14 +23,15 @@ foreach($config_default as $k => $v) if (!isset($config->{$k})) $config->{$k} = if (!preg_match('/^[A-Z2-7]+$/i', $config->secret)) die("Base32 encoded secret required\n"); $totp = new TOTP(null, $config->secret, $config->period, $config->digest, $config->digits); while(true) { - sleep($config->delay); echo "Czas serwera: "; $now = new DateTime(); echo $now->format('Y-m-d H:i:s'); echo "\n"; echo "Podaj kod:\n"; $code = readline(); - if ($totp->verify($code, null, $config->window)) { + $verify_result = $totp->verify($code, null, $config->window); + sleep($config->delay); + if ($verify_result) { break; } else { echo "Zły kod\n"; |
