From a120fa86554674a5d2e564568ccfe99046e9995b Mon Sep 17 00:00:00 2001 From: Piotr Pawlow Date: Sun, 19 Mar 2017 20:25:40 +0100 Subject: Allow spaces in secret. --- auth.php | 1 + 1 file changed, 1 insertion(+) diff --git a/auth.php b/auth.php index 0ba30c1..739123a 100644 --- a/auth.php +++ b/auth.php @@ -28,6 +28,7 @@ $config_default = load_config(__DIR__.'/config_default.json'); foreach($config_default as $k => $v) if (!isset($config->{$k})) $config->{$k} = $v; foreach($options as $k => $v) if ($k !== 'c') $config->{$k} = $v; +$config->secret = strtr($config->secret, [' ' => '']); 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) { -- cgit v1.2.3