2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
2020-06-23 00:09:42 +05:30
|
|
|
import U2FAuthenticate from './authenticate';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
export default () => {
|
|
|
|
if (!gon.u2f) return;
|
|
|
|
|
|
|
|
const u2fAuthenticate = new U2FAuthenticate(
|
2020-06-23 00:09:42 +05:30
|
|
|
$('#js-authenticate-token-2fa'),
|
|
|
|
'#js-login-token-2fa-form',
|
2018-03-17 18:26:18 +05:30
|
|
|
gon.u2f,
|
|
|
|
document.querySelector('#js-login-2fa-device'),
|
|
|
|
document.querySelector('.js-2fa-form'),
|
|
|
|
);
|
|
|
|
u2fAuthenticate.start();
|
2020-06-23 00:09:42 +05:30
|
|
|
// needed in rspec (FakeU2fDevice)
|
2018-03-17 18:26:18 +05:30
|
|
|
gl.u2fAuthenticate = u2fAuthenticate;
|
|
|
|
};
|