diff --git a/ajax.php b/ajax.php index 78fb2ccb..ddf5639a 100644 --- a/ajax.php +++ b/ajax.php @@ -333,7 +333,7 @@ if (isset($_GET['share_generate_link'])) { 'body' => $body ] ]; - + $mail = addToMailQueue($mysqli, $data); if ($mail !== true) { @@ -499,5 +499,5 @@ if (isset($_GET['get_totp_token_via_id'])) { } if (isset($_GET['get_readable_pass'])) { - echo GenerateReadablePassword(4); + echo json_encode(GenerateReadablePassword(4)); } diff --git a/client_logins.php b/client_logins.php index 874f80f5..55f197e6 100644 --- a/client_logins.php +++ b/client_logins.php @@ -177,63 +177,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - - document.getElementById("otp_" + id).innerText = token - - } - ); - } - - function showOTPViaLoginID(login_id) { - // Send a GET request to ajax.php as ajax.php?get_totp_token_via_id=true&login_id=ID - jQuery.get( - "ajax.php", { - get_totp_token_via_id: 'true', - login_id: login_id - }, - function(data) { - //If we get a response from post.php, parse it as JSON - const token = JSON.parse(data); - - document.getElementById("otp_" + login_id).innerText = token - - } - ); - } - - function generatePassword() { - document.getElementById("password").value = "" - } - - function generatePassword() { - var url = '/ajax.php?get_readable_pass=true'; - - // Make an AJAX request to the server - var xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - - xhr.onreadystatechange = function() { - if (xhr.readyState == 4 && xhr.status == 200) { - var password = xhr.responseText; - - document.getElementById("password").value = password; - } - }; - xhr.send(); - } - + +