Example #1
0
$errormessage = "";
$twofa = new WHMCS_2FA();
$twofa->setAdminID($_SESSION['adminid']);
if ($whmcs->get_req_var("2fasetup")) {
    if (!$twofa->isActiveAdmins()) {
        exit("Access denied");
    }
    ob_start();
    if ($twofa->isEnabled()) {
        echo "<div class=\"content\"><div style=\"padding:15px;\">";
        $disabled = $incorrect = false;
        if ($password = $whmcs->get_req_var("pwverify")) {
            $auth = new WHMCS_Auth();
            $auth->getInfobyID($_SESSION['adminid']);
            if ($auth->comparePassword($password)) {
                $twofa->disableUser();
                $disabled = true;
            } else {
                $incorrect = true;
            }
        }
        echo "<h2>" . $aInt->lang("twofa", "disable") . "</h2>";
        if (!$disabled) {
            echo "<p>" . $aInt->lang("twofa", "disableintro") . "</p>";
            if ($incorrect) {
                echo "<div class=\"errorbox\"><strong>Password Incorrect</strong><br />Please try again...</div>";
            }
            echo "<form onsubmit=\"dialogSubmit();return false\"><input type=\"hidden\" name=\"2fasetup\" value=\"1\" /><p align=\"center\">" . $aInt->lang("fields", "password") . ": <input type=\"password\" name=\"pwverify\" value=\"\" size=\"20\" /><p><p align=\"center\"><input type=\"button\" value=\"" . $aInt->lang("global", "disable") . "\" class=\"btn\" onclick=\"dialogSubmit()\" /></p></form>";
        } else {
            echo "<p>" . $aInt->lang("twofa", "disabledconfirmation") . "</p><p align=\"center\"><input type=\"button\" value=\"" . $aInt->lang("global", "close") . "\" onclick=\"window.location='myaccount.php'\" /></p>";
        }