2fa release
This commit is contained in:
parent
4544d2ffde
commit
c13fa32eef
|
|
@ -132,7 +132,6 @@ try
|
|||
$banned = checkIfBanned($GLOBALS['user']->id);
|
||||
$twofactor = isSession2FAUnlocked();
|
||||
|
||||
|
||||
//step 1, check if under maintenance
|
||||
if ($maintenance) { //maintenance redirect
|
||||
if ($accesseddirectory != "/maintenance.php") {
|
||||
|
|
|
|||
|
|
@ -5334,7 +5334,7 @@ function initialize2FA($userid)
|
|||
$username = getUsername($userid);
|
||||
if ($username) {
|
||||
$secret = safeGenerate2FASecret();
|
||||
$qrcode = $GLOBALS['authenticator']->getQRCodeGoogleUrl($username, $secret, "alphaland.cc");
|
||||
$qrcode = $GLOBALS['authenticator']->getQRCodeGoogleUrl($username, $secret, "Alphaland");
|
||||
$new2fa = $GLOBALS['pdo']->prepare("INSERT INTO `google_2fa`(`userid`, `secret`, `qr`, `whenGenerated`) VALUES (:uid, :secret, :qr, UNIX_TIMESTAMP())");
|
||||
$new2fa->bindParam(":uid", $userid, PDO::PARAM_INT);
|
||||
$new2fa->bindParam(":secret", $secret, PDO::PARAM_STR);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ $body = <<<EOT
|
|||
<div class="card-body text-center">
|
||||
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
|
||||
<a class="nav-link active red-a-nounder" id="v-pills-account-tab" data-toggle="pill" href="#v-pills-account" role="tab" aria-controls="v-pills-account" aria-selected="true">Account</a>
|
||||
<a style="display:none;" class="nav-link red-a-nounder" id="v-pills-2fa-tab" data-toggle="pill" href="#v-pills-2fa" role="tab" aria-controls="v-pills-2fa" aria-selected="false">2FA</a>
|
||||
<a class="nav-link red-a-nounder" id="v-pills-2fa-tab" data-toggle="pill" href="#v-pills-2fa" role="tab" aria-controls="v-pills-2fa" aria-selected="false">2FA</a>
|
||||
<a class="nav-link red-a-nounder" id="v-pills-privacy-tab" data-toggle="pill" href="#v-pills-privacy" role="tab" aria-controls="v-pills-privacy" aria-selected="false">Privacy</a>
|
||||
<a class="nav-link red-a-nounder" id="v-pills-theme-tab" data-toggle="pill" href="#v-pills-theme" role="tab" aria-controls="v-pills-theme" aria-selected="false">Theme</a>
|
||||
<a style="display:none;" class="nav-link red-a-nounder" id="v-pills-referral-tab" data-toggle="pill" href="#v-pills-referral" role="tab" aria-controls="v-pills-referral" aria-selected="false">Referrals</a>
|
||||
|
|
@ -328,11 +328,6 @@ function initializeSettings()
|
|||
} else {
|
||||
$("#settings_email_unverified").show()
|
||||
}
|
||||
|
||||
//currently locked to feature testers
|
||||
if(object.featuretester) {
|
||||
$("#v-pills-2fa-tab").show()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,8 @@ $joinpref = $userquery->canJoin;
|
|||
$tradepref = null;
|
||||
$theme = $userquery->theme;
|
||||
|
||||
//feature tester locked
|
||||
//initialize 2FA in the database if it hasnt been already
|
||||
if (inFeatureTesterGroup($userid)) {
|
||||
initialize2FA($userid);
|
||||
}
|
||||
initialize2FA($userid);
|
||||
|
||||
$userInfo = array (
|
||||
"userid" => $userid,
|
||||
|
|
@ -38,7 +35,6 @@ $userInfo = array (
|
|||
"email" => $email,
|
||||
"verified" => $verified,
|
||||
"blurb" => $blurb,
|
||||
"featuretester" => inFeatureTesterGroup($userid),
|
||||
"twofactorenabled" => is2FAInitialized($userid),
|
||||
"referralprogram" => inReferralProgram($userid),
|
||||
"joinpref" => $joinpref,
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@ header("access-control-allow-credentials: true");
|
|||
|
||||
$userid = $user->id;
|
||||
|
||||
//feature tester locked
|
||||
if (!inFeatureTesterGroup($userid)) {
|
||||
die(http_response_code(401));
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'));
|
||||
|
||||
if (!$data)
|
||||
|
|
|
|||
|
|
@ -11,9 +11,4 @@ header('Content-Type: application/json');
|
|||
|
||||
$userid = $user->id;
|
||||
|
||||
//feature tester locked
|
||||
if (!inFeatureTesterGroup($userid)) {
|
||||
die(http_response_code(401));
|
||||
}
|
||||
|
||||
echo json_encode(array("success" => deleteUser2FA($userid)));
|
||||
|
|
@ -12,9 +12,4 @@ header('Content-Type: application/json');
|
|||
|
||||
$userid = $user->id;
|
||||
|
||||
//feature tester locked
|
||||
if (!inFeatureTesterGroup($userid)) {
|
||||
die(http_response_code(401));
|
||||
}
|
||||
|
||||
die(json_encode(["qr"=>getUser2FAQR($userid)]));
|
||||
Loading…
Reference in New Issue