diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 9c34f0e40..1ad622d52 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -1690,7 +1690,7 @@ msgstr "没有上传下载权限" #: authentication/errors.py:366 msgid "Please enter MFA code" -msgstr "请输入6位动态安全码" +msgstr "请输入验证码" #: authentication/errors.py:370 msgid "Please enter SMS code" diff --git a/apps/templates/_mfa_login_field.html b/apps/templates/_mfa_login_field.html index 6164e0a4c..8a9a1eb71 100644 --- a/apps/templates/_mfa_login_field.html +++ b/apps/templates/_mfa_login_field.html @@ -54,9 +54,13 @@ $(document).ready(function () { const mfaSelectRef = document.getElementById('mfa-select'); const preferMFA = localStorage.getItem(preferMFAKey); - if (preferMFA) { + const valueSelector = "value=" + preferMFA + const preferMFADisabled = $(`#mfa-select option[${valueSelector}]`).attr('disabled') + + if (preferMFA && !preferMFADisabled) { mfaSelectRef.value = preferMFA; } + const mfaSelect = mfaSelectRef.value; if (mfaSelect !== null) { selectChange(mfaSelect, true); @@ -73,7 +77,10 @@ $('.input-style').each(function (i, ele){ $(ele).attr('name', '').attr('required', false) }) - $('#mfa-' + name + ' .input-style').attr('name', 'code').attr('required', true) + $('#mfa-' + name + ' .input-style') + .attr('name', 'code') + .attr('required', true) + .focus() } function sendChallengeCode(currentBtn) {