feat: enhance user settings with additional failed attempts and lock time configurations

This commit is contained in:
wxg0103 2025-12-17 09:51:49 +08:00
parent 96169239cc
commit 337124ca82
7 changed files with 58 additions and 14 deletions

View File

@ -157,4 +157,6 @@ export default {
display_codeTip: 'When the value is -1, the verification code is not displayed',
time: 'Times',
setting: 'Login Setting',
failedTip: 'Next, lock the account',
minute: 'Minutes',
}

View File

@ -155,6 +155,8 @@ export default {
display_code: '账号登录验证码设置',
loginFailed: '登录失败',
loginFailedMessage: '次显示验证码',
failedTip: '次,锁定账号',
minute: '分钟',
display_codeTip: '值为-1时不显示验证码',
time: '次',
setting: '登录设置',

View File

@ -156,6 +156,8 @@ export default {
loginFailed: '登入失敗',
loginFailedMessage: '次顯示驗證碼',
display_codeTip: '值為-1時不顯示驗證碼',
failedTip: '次,鎖定帳號',
minute: '分鐘',
time: '次',
setting: '登录設置',
}

View File

@ -67,7 +67,6 @@
{{ $t('views.login.resetPassword') }}
</el-dropdown-item>
<el-dropdown-item
v-if="chatUser.chatUserProfile?.source === 'LOCAL'"
class="border-t"
style="padding-top: 8px; padding-bottom: 8px"
@click="logout"

View File

@ -31,7 +31,6 @@
</div>
<div
v-if="chatUser.chatUserProfile?.source === 'LOCAL'"
class="card-item logout"
@click="logout"
>

View File

@ -78,7 +78,6 @@
{{ $t('views.login.resetPassword') }}
</el-dropdown-item>
<el-dropdown-item
v-if="chatUser.chatUserProfile?.source === 'LOCAL'"
class="border-t"
style="padding-top: 8px; padding-bottom: 8px"
@click="logout"

View File

@ -40,23 +40,56 @@
]"
prop="max_attempts"
>
<span style="font-size: 13px;">
<el-row :gutter="16">
<el-col :span="24">
<span style="font-size: 13px;">
{{ $t('views.system.loginFailed') }}
</span>
<el-input-number
style="margin-left: 8px;"
v-model="form.max_attempts"
:min="-1"
:max="10"
:step="1"
controls-position="right"
/>
<span style="margin-left: 8px; font-size: 13px;">
<el-input-number
style="margin-left: 8px;"
v-model="form.max_attempts"
:min="-1"
:max="10"
:step="1"
controls-position="right"
/>
<span style="margin-left: 8px; font-size: 13px;">
{{ $t('views.system.loginFailedMessage') }}
</span>
<span style="margin-left: 8px; color: #909399; font-size: 12px;">
<span style="margin-left: 8px; color: #909399; font-size: 12px;">
({{ $t('views.system.display_codeTip') }})
</span>
</el-col>
<el-col :span="24" style="margin-top: 8px;">
<span style="font-size: 13px;">
{{ $t('views.system.loginFailed') }}
</span>
<el-input-number
style="margin-left: 8px;"
v-model="form.failed_attempts"
:min="-1"
:max="10"
:step="1"
controls-position="right"
/>
<span style="margin-left: 8px; font-size: 13px;">
{{ $t('views.system.loginFailedMessage') }}
</span>
<el-input-number
style="margin-left: 8px;"
v-model="form.lock_time"
:min="-1"
:max="10"
:step="1"
controls-position="right"
/>
<span style="margin-left: 8px; font-size: 13px;">
分钟
</span>
</el-col>
</el-row>
</el-form-item>
</el-form>
<div style="margin-top:16px;">
@ -93,6 +126,8 @@ const authFormRef = ref<FormInstance>();
const form = ref<any>({
default_value: 'LOCAL',
max_attempts: 1,
failed_attempts: 5,
lock_time: 10,
})
const submit = async (formEl: FormInstance | undefined) => {
@ -117,6 +152,12 @@ onMounted(() => {
authApi.getLoginSetting().then((res) => {
if (Object.keys(res.data).length > 0) {
form.value = res.data;
if (!form.value.failed_attempts) {
form.value.failed_attempts = 5;
}
if (!form.value.lock_time) {
form.value.lock_time = 10;
}
loginMethods.value = res.data.auth_types
}
})