OTA improvements

This commit is contained in:
JonatanRek
2019-10-30 15:18:29 +01:00
parent 2200508fff
commit df71f7c780
8 changed files with 294 additions and 109 deletions

View File

@@ -3,6 +3,7 @@ class Setting extends Template
{
function __construct()
{
global $userManager;
global $langMng;
@@ -27,6 +28,24 @@ class Setting extends Template
$template->prepare('langMng', $langMng);
$template->prepare('automations', $automations);
$users = $userManager->getUsers();
$template->prepare('users', $users);
if ($userManager->getUserData('ota') == ''){
$ga = new PHPGangsta_GoogleAuthenticator();
$otaSecret = $ga->createSecret();
$qrCodeUrl = $ga->getQRCodeGoogleUrl('Smart Home', $otaSecret);
$oneCode = $ga->getCode($otaSecret);
$template->prepare('qrUrl', $qrCodeUrl);
$template->prepare('otaSecret', $otaSecret);
$template->prepare('otaCode', $oneCode);
// echo "Secret is: ".$secret."\n\n";
// echo "Google Charts URL for the QR-Code: ".$qrCodeUrl."\n\n";
// echo "Checking Code '$oneCode' and Secret '$otaSecret':\n";
}
$template->render();
}
}