unset($_SESSION['loginurlredirect']); } } if (!$gotourl) { $gotourl = "clientarea.php"; } if ($whmcs->get_req_var("newbackupcode")) { header("Location: " . $gotourl); exit; } $loginsuccess = $istwofa = false; $twofa = new WHMCS_2FA(); if ($twofa->isActiveClients() && isset($_SESSION['2faverifyc'])) { $twofa->setClientID($_SESSION['2faclientid']); if ($whmcs->get_req_var("backupcode")) { $success = $twofa->verifyBackupCode($whmcs->get_req_var("code")); } else { $success = $twofa->moduleCall("verify"); } if ($success) { validateClientLogin(get_query_val("tblclients", "email", array("id" => $_SESSION['2faclientid'])), "", true); if ($_SESSION['2farememberme']) { wSetCookie("User", $_SESSION['uid'] . ":" . sha1($_SESSION['upw'] . $whmcs->get_hash()), time() + 60 * 60 * 24 * 365); } else { wDelCookie("User"); } WHMCS_Session::delete("2faclientid"); WHMCS_Session::delete("2farememberme"); WHMCS_Session::delete("2faverifyc"); if ($whmcs->get_req_var("backupcode")) { WHMCS_Session::set("2fabackupcodenew", true);