fix: 修复登录mfa时,选择了禁用的

pull/7195/head^2
ibuler 3 years ago committed by Jiangjie.Bai
parent 4a786baf4e
commit 454d3cba96

@ -1690,7 +1690,7 @@ msgstr "没有上传下载权限"
#: authentication/errors.py:366 #: authentication/errors.py:366
msgid "Please enter MFA code" msgid "Please enter MFA code"
msgstr "请输入6位动态安全码" msgstr "请输入验证码"
#: authentication/errors.py:370 #: authentication/errors.py:370
msgid "Please enter SMS code" msgid "Please enter SMS code"

@ -54,9 +54,13 @@
$(document).ready(function () { $(document).ready(function () {
const mfaSelectRef = document.getElementById('mfa-select'); const mfaSelectRef = document.getElementById('mfa-select');
const preferMFA = localStorage.getItem(preferMFAKey); 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; mfaSelectRef.value = preferMFA;
} }
const mfaSelect = mfaSelectRef.value; const mfaSelect = mfaSelectRef.value;
if (mfaSelect !== null) { if (mfaSelect !== null) {
selectChange(mfaSelect, true); selectChange(mfaSelect, true);
@ -73,7 +77,10 @@
$('.input-style').each(function (i, ele){ $('.input-style').each(function (i, ele){
$(ele).attr('name', '').attr('required', false) $(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) { function sendChallengeCode(currentBtn) {

Loading…
Cancel
Save