From fda40055f8663aa3ad5c1f0d247a44f6b13c550a Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 24 Apr 2022 13:48:27 +0100 Subject: [PATCH] Adjust RFC6283 getTokenCode to only show one token at a time. Remove the tokens from client_logins.php and replace with a mouseover/hover to show mechanism using ajax.php --- ajax.php | 11 +++++++++++ client_logins.php | 23 +++++++++++++++++++---- rfc6238.php | 19 +++++++++---------- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/ajax.php b/ajax.php index d5e212c2..26a33637 100644 --- a/ajax.php +++ b/ajax.php @@ -9,6 +9,7 @@ include("config.php"); include("functions.php"); include("check_login.php"); +require_once("rfc6238.php"); /* * Fetches SSL certificates from remote hosts & returns the relevant info (issuer, expiry, public key) @@ -304,4 +305,14 @@ if(isset($_GET['scheduled_ticket_get_json_details'])){ echo json_encode($response); +} + +/* + * Dynamic TOTP for client login page + * When provided with a TOTP secret, returns a 6-digit code + */ +if(isset($_GET['get_totp_token'])){ + $otp = TokenAuth6238::getTokenCode($_GET['totp_secret']); + + echo json_encode($otp); } \ No newline at end of file diff --git a/client_logins.php b/client_logins.php index 74c7bd52..db90e544 100644 --- a/client_logins.php +++ b/client_logins.php @@ -1,7 +1,5 @@ $otp"; + $otp_display = " Hover.."; } $login_note = $row['login_note']; $login_contact_id = $row['login_contact_id']; @@ -141,6 +139,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); + +