diff options
Diffstat (limited to 'app/assets/javascripts/pages/profiles/two_factor_auths/index.js')
-rw-r--r-- | app/assets/javascripts/pages/profiles/two_factor_auths/index.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/app/assets/javascripts/pages/profiles/two_factor_auths/index.js b/app/assets/javascripts/pages/profiles/two_factor_auths/index.js index 186072531b8..50835333a54 100644 --- a/app/assets/javascripts/pages/profiles/two_factor_auths/index.js +++ b/app/assets/javascripts/pages/profiles/two_factor_auths/index.js @@ -2,17 +2,15 @@ import { mount2faRegistration } from '~/authentication/mount_2fa'; import { initRecoveryCodes } from '~/authentication/two_factor_auth'; import { parseBoolean } from '~/lib/utils/common_utils'; -document.addEventListener('DOMContentLoaded', () => { - const twoFactorNode = document.querySelector('.js-two-factor-auth'); - const skippable = twoFactorNode ? parseBoolean(twoFactorNode.dataset.twoFactorSkippable) : false; +const twoFactorNode = document.querySelector('.js-two-factor-auth'); +const skippable = twoFactorNode ? parseBoolean(twoFactorNode.dataset.twoFactorSkippable) : false; - 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); - } +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); +} - mount2faRegistration(); -}); +mount2faRegistration(); initRecoveryCodes(); |