snappymail/plugins/two-factor-auth/js/TwoFactorAuthLogin.js

24 lines
866 B
JavaScript
Raw Normal View History

2021-07-23 19:36:38 +08:00
(rl => {
rl && addEventListener('rl-view-model', e => {
if (e.detail && 'Login' === e.detail.viewModelTemplateID) {
2021-07-23 19:36:38 +08:00
const container = e.detail.viewModelDom.querySelector('#plugin-Login-BottomControlGroup'),
2021-07-23 22:18:23 +08:00
placeholder = 'LOGIN/LABEL_TWO_FACTOR_CODE';
2021-07-23 19:36:38 +08:00
if (container) {
2021-07-23 21:58:54 +08:00
container.prepend(Element.fromHTML('<div class="controls">'
2021-07-23 19:36:38 +08:00
+ '<div class="input-append">'
+ '<input name="totp_code" type="text" class="input-block-level inputIcon"'
+ ' pattern="[0-9]*" inputmode="numeric"'
+ ' autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false"'
+ ' data-bind="textInput: totp, disable: submitRequest" data-i18n="[placeholder]'+placeholder
+ '" placeholder="'+rl.i18n(placeholder)+'">'
+ '<i class="add-on fontastic">🔑</i>'
+ '</div>'
+ '</div>'));
}
}
});
})(window.rl);