forked from D3Public/oxtotp
38 lines
1.2 KiB
Smarty
38 lines
1.2 KiB
Smarty
[{* from https://github.com/jcjones/webauthn.bin.coffee *}]
|
|
|
|
[{oxscript include=$oViewConf->getModuleUrl('d3totp', 'out/src/js/index.js')}]
|
|
|
|
[{capture name="d3script"}]
|
|
var creationOptions = [{$creationOptions}];
|
|
createCredentials(creationOptions);
|
|
[{***
|
|
// Import the tool(s) ou need
|
|
import {useRegistration} from '@web-auth/webauthn-helper';
|
|
|
|
// We want to register new authenticators
|
|
const register = useRegistration({
|
|
actionUrl: '/api/register',
|
|
optionsUrl: '/api/register/options'
|
|
});
|
|
|
|
register({
|
|
username: 'FOO4',
|
|
displayName: 'baR'
|
|
})
|
|
.then((response)=> console.log('Registration success'))
|
|
.catch((error)=> console.log('Registration failure'))
|
|
;
|
|
***}]
|
|
[{/capture}]
|
|
[{oxscript add=$smarty.capture.d3script}]
|
|
--A--
|
|
<form id="webauthn" action="[{$oViewConf->getSelfActionLink()}]" method="post">
|
|
[{$oViewConf->getHiddenSid()}]
|
|
[{$oViewConf->getNavFormParams()}]
|
|
<input type="hidden" name="fnc" value="saveAuthn">
|
|
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
|
|
<input type="hidden" name="credential" value='credent'>
|
|
</form>
|
|
--B--
|
|
|
|
[{$smarty.block.parent}] |