summaryrefslogtreecommitdiff
path: root/auth.php
diff options
context:
space:
mode:
Diffstat (limited to 'auth.php')
-rw-r--r--auth.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/auth.php b/auth.php
index 7e839c9..ccb2859 100644
--- a/auth.php
+++ b/auth.php
@@ -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";