summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/authentication/u2f/index.js
blob: 6e0d1c308f6eeacb19268acb0d9b1d676586e03f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import $ from 'jquery';
import U2FAuthenticate from './authenticate';

export default () => {
  if (!gon.u2f) return;

  const u2fAuthenticate = new U2FAuthenticate(
    $('#js-authenticate-u2f'),
    '#js-login-u2f-form',
    gon.u2f,
    document.querySelector('#js-login-2fa-device'),
    document.querySelector('.js-2fa-form'),
  );
  u2fAuthenticate.start();
  // needed in rspec (FakeU2fDevice)
  gl.u2fAuthenticate = u2fAuthenticate;
};