adding first part of 2fa

This commit is contained in:
jakani24
2024-06-06 16:08:13 +02:00
parent 7c22a1e104
commit 538c60197a
6 changed files with 8 additions and 4 deletions

View File

@@ -49,7 +49,7 @@
$success=0;
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);
$email=htmlspecialchars($_POST["email"]);

View File

@@ -68,6 +68,7 @@
user_hex_id VARCHAR(255),
credential_id VARBINARY(64),
allow_pw_login INT,
use_2fa INT,
send_login_message INT,
public_key TEXT,
counter INT

View File

@@ -304,6 +304,8 @@ async function checkRegistration() {
$_SESSION["telegram_id"]=$row["telegram_id"];
$_SESSION["allow_pw_login"]=$row["allow_pw_login"];
$_SESSION["send_login_message"]=$row["send_login_message"];
$_SESSION["use_2fa"]=$row["use_2fa"];
if($_SESSION["send_login_message"]=="1"){
$ip = $_SERVER['REMOTE_ADDR'];
$username=$row["username"];

View File

@@ -178,6 +178,7 @@ try {
$_SESSION["telegram_id"]=$row["telegram_id"];
$_SESSION["allow_pw_login"]=$row["allow_pw_login"];
$_SESSION["send_login_message"]=$row["send_login_message"];
$_SESSION["use_2fa"]=$row["use_2fa"];
if($_SESSION["send_login_message"]=="1"){
$ip = $_SERVER['REMOTE_ADDR'];
$username=$row["username"];

View File

@@ -156,7 +156,7 @@ include "perms_functions.php";
$success=0;
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);
$email=htmlspecialchars($_POST["email"]);

View File

@@ -94,7 +94,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
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>
<br>
<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'>");
}
?>
<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>
<br>
<button type="submit" class="btn btn-primary btn-block">Update</button>