Allow spaces in secret.

Piotr Pawlow [2017-03-19 19:25:40]
Allow spaces in secret.
Filename
auth.php
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) {
ViewGit