[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] [{*assign var="webauthn" value=$edit->d3GetWebauthn()}]*}] [{assign var="userid" value=$edit->getId()}] [{*$webauthn->loadByUserId($userid)*}] [{if $readonly}] [{assign var="readonly" value="readonly disabled"}] [{else}] [{assign var="readonly" value=""}] [{/if}]
[{$oViewConf->getHiddenSid()}]
[{$oViewConf->getHiddenSid()}] [{* *}] [{if $sSaveError}]
[{oxmultilang ident=$sSaveError}]
[{/if}] [{capture name="javascripts"}] function arrayToBase64String(a) { return btoa(String.fromCharCode(...a)); } function base64url2base64(input) { input = input .replace(/=/g, "") .replace(/-/g, '+') .replace(/_/g, '/'); const pad = input.length % 4; if(pad) { if(pad === 1) { throw new Error('InvalidLengthError: Input base64url string is the wrong length to determine padding'); } input += new Array(5-pad).join('='); } return input; } function authnregister() { try { let publicKey = [{$webauthn_publickey_register}]; console.log('71'); publicKey.challenge = Uint8Array.from(window.atob(base64url2base64(publicKey.challenge)), function(c){return c.charCodeAt(0);}); publicKey.user.id = Uint8Array.from(window.atob(publicKey.user.id), function(c){return c.charCodeAt(0);}); console.log('74'); if (publicKey.excludeCredentials) { publicKey.excludeCredentials = publicKey.excludeCredentials.map(function(data) { data.id = Uint8Array.from(window.atob(base64url2base64(data.id)), function(c){return c.charCodeAt(0);}); return data; }); } console.log('81'); navigator.credentials.create({ 'publicKey': publicKey }).then(function(data){ console.log('83'); let publicKeyCredential = { id: data.id, type: data.type, rawId: arrayToBase64String(new Uint8Array(data.rawId)), response: { clientDataJSON: arrayToBase64String(new Uint8Array(data.response.clientDataJSON)), attestationObject: arrayToBase64String(new Uint8Array(data.response.attestationObject)) } }; console.log('92'); document.getElementById('fncname').value = 'registerNewKey'; console.log('94'); document.getElementById('authnvalue').value = btoa(JSON.stringify(publicKeyCredential)); console.log('96'); }).catch(function(error){ console.log(error); // document.getElementById('errorvalue').value = btoa(JSON.stringify(error)); // document.getElementById('myedit').submit(); }); } catch (e) { console.log(e); } } function deleteItem(id) { document.getElementById('fncname').value = 'deleteKey'; document.getElementById('oxidvalue').value = id; document.getElementById('actionform').submit(); } function toggle(elementId) { $("#" + elementId).toggle(); } [{/capture}] [{oxscript add=$smarty.capture.javascripts}] [{if $oxid && $oxid != '-1'}]
[{block name="user_d3user_totp_form1"}] [{/block}]

[{oxmultilang ident="D3_WEBAUTHN_REGISTERNEW"}]

[{block name="user_d3user_totp_form2"}] [{foreach from=$oView->getCredentialList($userid) item="credential"}] [{*** ***}] [{/foreach}] [{/block}]

[{oxmultilang ident="D3_WEBAUTHN_REGISTEREDKEYS"}]

[{** [{$credential->d3GetName()}] (last used: XX) **}] [{$credential->getId()}]
[{/if}]
[{include file="bottomnaviitem.tpl"}] [{include file="bottomitem.tpl"}]