From b5575bb0d974442f7bd1525f3b960b089dffd48f Mon Sep 17 00:00:00 2001 From: jakani24 Date: Fri, 26 Apr 2024 14:53:47 +0200 Subject: [PATCH] Update login.php --- src/server/cyberhex-code/test/login.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/cyberhex-code/test/login.php b/src/server/cyberhex-code/test/login.php index 01a292a..a768613 100644 --- a/src/server/cyberhex-code/test/login.php +++ b/src/server/cyberhex-code/test/login.php @@ -354,8 +354,10 @@ try { // Retrieve registration data from the database based on credential ID $id = base64_decode($post->id); $stmt = $conn->prepare("SELECT * FROM users WHERE credential_id = ?"); - $stmt->execute([$id]); - $registration = $stmt->fetch(PDO::FETCH_ASSOC); + $stmt->bind_param("s", $_SESSION["registrations"]["credentialId"]); + $stmt->execute(); + $registration = $stmt->get_result(); + $row = $registration->fetch_assoc(); if (!$registration) { throw new Exception('Public Key for credential ID not found!'); @@ -366,7 +368,7 @@ try { $signature = base64_decode($post->signature); $userHandle = base64_decode($post->userHandle); $challenge = $_SESSION['challenge'] ?? ''; - $credentialPublicKey = $registration['public_key']; + $credentialPublicKey = $row['public_key']; // Process the get request $WebAuthn->processGet($clientDataJSON, $authenticatorData, $signature, $credentialPublicKey, $challenge, null, $userVerification === 'required');