[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] WebAuthn: Fix passkey timestamp display and duplicate-credential check

"Bruno Kambere \(@kambereBr\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a8450dd6db95_3859399507458b@gitlab-sidekiq-low-urgency-cpu-bound-v2-b96b6f55-pp6qk.mail>

Bruno Kambere pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
a2d2a43f by Camile at 2026-08-18T15:14:28+03:00
[FIX] WebAuthn: Fix passkey timestamp display and duplicate-credential check
---
* [FIX] WebAuthn: Show passkey timestamps in user's local time, not server time

* [FIX] WebAuthn: Dedupe passkeys by credential_id instead of aaguid

See merge request tikiwiki/tiki!10728

- - - - -


2 changed files:

- lib/core/Services/Webauthn/WebauthnController.php
- templates/tiki-webauthn.tpl


Changes:

=====================================
lib/core/Services/Webauthn/WebauthnController.php
=====================================
@@ -183,29 +183,30 @@ class WebauthnController
 
             $deviceName = $input->device_name->text();
             $aaguid = (string) $attestationObject->authData->attestedCredentialData->aaguid;
+            $credentialId = base64_encode($publicKeyCredentialSource->publicKeyCredentialId);
 
-            $existingAuthenticator = $this->webAuthnTable->fetchRow(['authenticator_id'], [
-                'authenticator_id' => $aaguid,
+            $existingCredential = $this->webAuthnTable->fetchRow(['credential_id'], [
+                'credential_id' => $credentialId,
                 'user' => $publicKeyCredentialCreationOptions->user->name
             ]);
 
-            if ($existingAuthenticator) {
+            if ($existingCredential) {
                 return [
                     'status' => 'success',
                     'code' => 'AUTHENTICATOR_EXIST',
-                    'message' => tr('This authenticator has already been registered.')
+                    'message' => tr('This passkey has already been registered.')
                 ];
             }
 
             $this->webAuthnTable->insert([
-                'credential_id' => base64_encode($publicKeyCredentialSource->publicKeyCredentialId),
+                'credential_id' => $credentialId,
                 'public_key' => base64_encode($publicKeyCredentialSource->credentialPublicKey),
                 'sign_count' => $publicKeyCredentialSource->counter,
                 'user' => $publicKeyCredentialCreationOptions->user->name,
                 'user_handle' => $publicKeyCredentialSource->userHandle,
                 'device_name' => $deviceName,
                 'authenticator_id' => $aaguid,
-                'created_at' => date('Y-m-d H:i:s')
+                'created_at' => gmdate('Y-m-d H:i:s')
             ]);
 
             return [
@@ -312,7 +313,7 @@ class WebauthnController
                 $_SESSION['webauthn_user'] = $userName;
                 $this->webAuthnTable->update([
                     'sign_count' => $signCount,
-                    'last_signin' => date('Y-m-d H:i:s')
+                    'last_signin' => gmdate('Y-m-d H:i:s')
                 ], [
                     'credential_id' => $credential_id,
                 ]);


=====================================
templates/tiki-webauthn.tpl
=====================================
@@ -24,8 +24,8 @@
                         <td> {$devices[device].authenticator_name} </td>
                         <td> {$devices[device].device_name} </td>
                         <td> {$devices[device].sign_count} </td>
-                        <td> {$devices[device].created_at} </td>
-                        <td> {$devices[device].last_signin} </td>
+                        <td> {$devices[device].created_at|tiki_short_datetime} </td>
+                        <td> {$devices[device].last_signin|tiki_short_datetime} </td>
                         <td class="action">
                             {actions}
                                 <action>



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a2d2a43f12648cc5545b12d096d4c1c573a26eee

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a2d2a43f12648cc5545b12d096d4c1c573a26eee
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.