Update login.php

This commit is contained in:
jakani24
2024-04-26 14:53:47 +02:00
parent e911d795aa
commit b5575bb0d9

View File

@@ -354,8 +354,10 @@ try {
// Retrieve registration data from the database based on credential ID // Retrieve registration data from the database based on credential ID
$id = base64_decode($post->id); $id = base64_decode($post->id);
$stmt = $conn->prepare("SELECT * FROM users WHERE credential_id = ?"); $stmt = $conn->prepare("SELECT * FROM users WHERE credential_id = ?");
$stmt->execute([$id]); $stmt->bind_param("s", $_SESSION["registrations"]["credentialId"]);
$registration = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->execute();
$registration = $stmt->get_result();
$row = $registration->fetch_assoc();
if (!$registration) { if (!$registration) {
throw new Exception('Public Key for credential ID not found!'); throw new Exception('Public Key for credential ID not found!');
@@ -366,7 +368,7 @@ try {
$signature = base64_decode($post->signature); $signature = base64_decode($post->signature);
$userHandle = base64_decode($post->userHandle); $userHandle = base64_decode($post->userHandle);
$challenge = $_SESSION['challenge'] ?? ''; $challenge = $_SESSION['challenge'] ?? '';
$credentialPublicKey = $registration['public_key']; $credentialPublicKey = $row['public_key'];
// Process the get request // Process the get request
$WebAuthn->processGet($clientDataJSON, $authenticatorData, $signature, $credentialPublicKey, $challenge, null, $userVerification === 'required'); $WebAuthn->processGet($clientDataJSON, $authenticatorData, $signature, $credentialPublicKey, $challenge, null, $userVerification === 'required');