' . lang("2fa active", false) . ''
            . ''
            . lang("remove 2fa", false) . '';
} else if ($_GET['2fa'] == "generate") {
    $codeuri = newTOTP($_SESSION['username']);
    $qrCode = new QrCode($codeuri);
    $qrCode->setSize(200);
    $qrCode->setErrorCorrection("H");
    $qrcode = $qrCode->getDataUri();
    $totp = Factory::loadFromProvisioningUri($codeuri);
    $codesecret = $totp->getSecret();
    $chunk_secret = trim(chunk_split($codesecret, 8, ' '));
    $APPS["setup_2fa"]["content"] = ' ' . lang("scan 2fa qrcode", false) . '
' . <<
$chunk_secret
END;
} else {
    $APPS["setup_2fa"]["content"] = ' ' . lang("2fa explained", false) . '
'
            . ''
            . lang("enable 2fa", false) . '';
}