Implemented 2FA TOTP with Google Authenticator

This commit is contained in:
root
2019-06-16 22:33:55 -04:00
parent bc8091ae49
commit e247ad4ee4
13 changed files with 564 additions and 125 deletions

View File

@@ -16,6 +16,21 @@ function keygen()
return $key;
}
function key32gen()
{
$chars .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$chars .= "234567";
while (1) {
$key = '';
srand((double) microtime() * 1000000);
for ($i = 0; $i < 32; $i++) {
$key .= substr($chars, (rand() % (strlen($chars))), 1);
}
break;
}
return $key;
}
function initials($str) {
$ret = '';
foreach (explode(' ', $str) as $word)