snappymail/plugins/two-factor-auth/js/TwoFactorAuthLogin.js
djmaze 3bad2d5dbd Revamp login screens by moving login icons to the left,
due to issues with browser plugins like LastPass which place buttons on the right.
And added a TOTP icon
2021-11-16 12:35:11 +01:00

21 lines
796 B
JavaScript

(rl => {
rl && addEventListener('rl-view-model', e => {
if (e.detail && 'Login' === e.detail.viewModelTemplateID) {
const container = e.detail.viewModelDom.querySelector('#plugin-Login-BottomControlGroup'),
placeholder = 'LOGIN/LABEL_TWO_FACTOR_CODE';
if (container) {
container.prepend(Element.fromHTML('<div class="controls">'
+ '<span class="fontastic">⏱</span>'
+ '<input name="totp_code" type="text" class="input-block-level"'
+ ' 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)+'">'
+ '</div>'));
}
}
});
})(window.rl);