mirror of
https://github.com/slawkens/myaac.git
synced 2026-01-20 21:26:23 +01:00
[WIP] Working app auth (Still not ready)
Missing rec key validation Doesn't work with google recaptcha plugin
This commit is contained in:
@@ -27,3 +27,20 @@ if (!isset($account_logged) || !$account_logged->isLoaded()) {
|
||||
|
||||
$twoFactorAuth = TwoFactorAuth::getInstance($account_logged);
|
||||
$twig->addGlobal('account_logged', $account_logged);
|
||||
|
||||
/**
|
||||
* Took from ZnoteAAC
|
||||
* @author Znote
|
||||
*/
|
||||
function generateRandom2faSecret($length = 16): string
|
||||
{
|
||||
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user