From affbba50ca5766c0d05a2243d33d21cac356a9bf Mon Sep 17 00:00:00 2001 From: andryyy Date: Fri, 25 Oct 2019 19:13:24 +0200 Subject: [PATCH] [Web] Fix active U2F key in UI --- data/web/inc/functions.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 28831272..e3a568b4 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -1068,9 +1068,10 @@ function verify_tfa_login($username, $token) { case "u2f": try { $reg = $u2f->doAuthenticate(json_decode($_SESSION['authReq']), get_u2f_registrations($username), json_decode($token)); - $stmt = $pdo->prepare("UPDATE `tfa` SET `counter` = ? WHERE `id` = ?"); - $stmt->execute(array($reg->counter, $reg->id)); - $_SESSION['tfa_id'] = $reg->id; + $stmt = $pdo->prepare("SELECT `id` FROM `tfa` WHERE `keyHandle` = ?"); + $stmt->execute(array($reg->keyHandle)); + $row_key_id = $stmt->fetch(PDO::FETCH_ASSOC); + $_SESSION['tfa_id'] = $row_key_id['id']; $_SESSION['authReq'] = null; $_SESSION['return'][] = array( 'type' => 'success',