Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « two_factor_auths « profiles « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 95936c2d1db3038c746515a5db241b92b5b0fd34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import $ from 'jquery';
import U2FRegister from '~/u2f/register';
import { parseBoolean } from '~/lib/utils/common_utils';

document.addEventListener('DOMContentLoaded', () => {
  const twoFactorNode = document.querySelector('.js-two-factor-auth');
  const skippable = parseBoolean(twoFactorNode.dataset.twoFactorSkippable);

  if (skippable) {
    const button = `<a class="btn btn-sm btn-warning float-right" data-qa-selector="configure_it_later_button" data-method="patch" href="${twoFactorNode.dataset.two_factor_skip_url}">Configure it later</a>`;
    const flashAlert = document.querySelector('.flash-alert');
    if (flashAlert) flashAlert.insertAdjacentHTML('beforeend', button);
  }

  const u2fRegister = new U2FRegister($('#js-register-u2f'), gon.u2f);
  u2fRegister.start();
});