adding first part of 2fa
This commit is contained in:
@@ -49,7 +49,7 @@
|
|||||||
$success=0;
|
$success=0;
|
||||||
die("Connection failed: " . $conn->connect_error);
|
die("Connection failed: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
$stmt = $conn->prepare("INSERT INTO users (email, username, password,perms,allow_pw_login) VALUES (?, ?, ?, ?,1)");
|
$stmt = $conn->prepare("INSERT INTO users (email, username, password,perms,allow_pw_login,send_login_message,use_2fa) VALUES (?, ?, ?, ?,1,0,0)");
|
||||||
$stmt->bind_param("ssss", $email, $username, $hash, $permissions);
|
$stmt->bind_param("ssss", $email, $username, $hash, $permissions);
|
||||||
|
|
||||||
$email=htmlspecialchars($_POST["email"]);
|
$email=htmlspecialchars($_POST["email"]);
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
user_hex_id VARCHAR(255),
|
user_hex_id VARCHAR(255),
|
||||||
credential_id VARBINARY(64),
|
credential_id VARBINARY(64),
|
||||||
allow_pw_login INT,
|
allow_pw_login INT,
|
||||||
|
use_2fa INT,
|
||||||
send_login_message INT,
|
send_login_message INT,
|
||||||
public_key TEXT,
|
public_key TEXT,
|
||||||
counter INT
|
counter INT
|
||||||
|
|||||||
@@ -304,6 +304,8 @@ async function checkRegistration() {
|
|||||||
$_SESSION["telegram_id"]=$row["telegram_id"];
|
$_SESSION["telegram_id"]=$row["telegram_id"];
|
||||||
$_SESSION["allow_pw_login"]=$row["allow_pw_login"];
|
$_SESSION["allow_pw_login"]=$row["allow_pw_login"];
|
||||||
$_SESSION["send_login_message"]=$row["send_login_message"];
|
$_SESSION["send_login_message"]=$row["send_login_message"];
|
||||||
|
$_SESSION["use_2fa"]=$row["use_2fa"];
|
||||||
|
|
||||||
if($_SESSION["send_login_message"]=="1"){
|
if($_SESSION["send_login_message"]=="1"){
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
$username=$row["username"];
|
$username=$row["username"];
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ try {
|
|||||||
$_SESSION["telegram_id"]=$row["telegram_id"];
|
$_SESSION["telegram_id"]=$row["telegram_id"];
|
||||||
$_SESSION["allow_pw_login"]=$row["allow_pw_login"];
|
$_SESSION["allow_pw_login"]=$row["allow_pw_login"];
|
||||||
$_SESSION["send_login_message"]=$row["send_login_message"];
|
$_SESSION["send_login_message"]=$row["send_login_message"];
|
||||||
|
$_SESSION["use_2fa"]=$row["use_2fa"];
|
||||||
if($_SESSION["send_login_message"]=="1"){
|
if($_SESSION["send_login_message"]=="1"){
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
$username=$row["username"];
|
$username=$row["username"];
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ include "perms_functions.php";
|
|||||||
$success=0;
|
$success=0;
|
||||||
die("Connection failed: " . $conn->connect_error);
|
die("Connection failed: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
$stmt = $conn->prepare("INSERT INTO users (email, username, password,perms,allow_pw_login) VALUES (?, ?, ?, ?,1)");
|
$stmt = $conn->prepare("INSERT INTO users (email, username, password,perms,allow_pw_login,send_login_message,use_2fa) VALUES (?, ?, ?, ?,1,0,0)");
|
||||||
$stmt->bind_param("ssss", $email, $username, $hash, $permissions);
|
$stmt->bind_param("ssss", $email, $username, $hash, $permissions);
|
||||||
|
|
||||||
$email=htmlspecialchars($_POST["email"]);
|
$email=htmlspecialchars($_POST["email"]);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
echo("<input type='checkbox' id='pw_login' name='pw_login'>");
|
echo("<input type='checkbox' id='pw_login' name='pw_login'>");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<label for="pw_login">Allow password logins. (Please make shure you have a passkey, if you disable this!)</label>
|
<label for="pw_login">Allow password logins. (Please make shure you have a working passkey, if you disable this!)</label>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -105,7 +105,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
echo("<input type='checkbox' id='send_login_message' name='send_login_message'>");
|
echo("<input type='checkbox' id='send_login_message' name='send_login_message'>");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<label for="send_login_message">Send you a message when somebody logs in with your account (You need to set your Telegram id for this to work)</label>
|
<label for="send_login_message">Send you a Telegram message when somebody logs in with your account.</label>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<button type="submit" class="btn btn-primary btn-block">Update</button>
|
<button type="submit" class="btn btn-primary btn-block">Update</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user