debian-mirror-gitlab/app/assets/javascripts/authentication/webauthn/index.js

30 lines
710 B
JavaScript
Raw Normal View History

2020-11-24 15:15:51 +05:30
import $ from 'jquery';
import WebAuthnAuthenticate from './authenticate';
2023-05-27 22:25:52 +05:30
import WebAuthnRegister from './register';
export const initWebauthnAuthenticate = () => {
if (!gon.webauthn) {
return;
}
2020-11-24 15:15:51 +05:30
const webauthnAuthenticate = new WebAuthnAuthenticate(
$('#js-authenticate-token-2fa'),
'#js-login-token-2fa-form',
gon.webauthn,
document.querySelector('#js-login-2fa-device'),
document.querySelector('.js-2fa-form'),
);
webauthnAuthenticate.start();
};
2023-05-27 22:25:52 +05:30
export const initWebauthnRegister = () => {
const el = $('#js-register-token-2fa');
if (!el.length) {
return;
}
const webauthnRegister = new WebAuthnRegister(el, gon.webauthn);
webauthnRegister.start();
};