2018-03-17 18:26:18 +05:30
|
|
|
import U2FRegister from './u2f/register';
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
const twoFactorNode = document.querySelector('.js-two-factor-auth');
|
|
|
|
const skippable = twoFactorNode.dataset.twoFactorSkippable === 'true';
|
|
|
|
if (skippable) {
|
|
|
|
const button = `<a class="btn btn-xs btn-warning pull-right" data-method="patch" href="${twoFactorNode.dataset.two_factor_skip_url}">Configure it later</a>`;
|
|
|
|
const flashAlert = document.querySelector('.flash-alert .container-fluid');
|
|
|
|
if (flashAlert) flashAlert.insertAdjacentHTML('beforeend', button);
|
|
|
|
}
|
|
|
|
|
|
|
|
const u2fRegister = new U2FRegister($('#js-register-u2f'), gon.u2f);
|
|
|
|
u2fRegister.start();
|
|
|
|
});
|