Skip to content

Commit 337124c

Browse files
committed
feat: enhance user settings with additional failed attempts and lock time configurations
1 parent 9616923 commit 337124c

File tree

7 files changed

+58
-14
lines changed

7 files changed

+58
-14
lines changed

ui/src/locales/lang/en-US/views/system.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,6 @@ export default {
157157
display_codeTip: 'When the value is -1, the verification code is not displayed',
158158
time: 'Times',
159159
setting: 'Login Setting',
160+
failedTip: 'Next, lock the account',
161+
minute: 'Minutes',
160162
}

ui/src/locales/lang/zh-CN/views/system.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ export default {
155155
display_code: '账号登录验证码设置',
156156
loginFailed: '登录失败',
157157
loginFailedMessage: '次显示验证码',
158+
failedTip: '次,锁定账号',
159+
minute: '分钟',
158160
display_codeTip: '值为-1时,不显示验证码',
159161
time: '次',
160162
setting: '登录设置',

ui/src/locales/lang/zh-Hant/views/system.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ export default {
156156
loginFailed: '登入失敗',
157157
loginFailedMessage: '次顯示驗證碼',
158158
display_codeTip: '值為-1時,不顯示驗證碼',
159+
failedTip: '次,鎖定帳號',
160+
minute: '分鐘',
159161
time: '次',
160162
setting: '登录設置',
161163
}

ui/src/views/chat/embed/component/ChatHistoryDrawer.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
{{ $t('views.login.resetPassword') }}
6868
</el-dropdown-item>
6969
<el-dropdown-item
70-
v-if="chatUser.chatUserProfile?.source === 'LOCAL'"
7170
class="border-t"
7271
style="padding-top: 8px; padding-bottom: 8px"
7372
@click="logout"

ui/src/views/chat/mobile/component/UserCenterDrawer.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
</div>
3232

3333
<div
34-
v-if="chatUser.chatUserProfile?.source === 'LOCAL'"
3534
class="card-item logout"
3635
@click="logout"
3736
>

ui/src/views/chat/pc/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
{{ $t('views.login.resetPassword') }}
7979
</el-dropdown-item>
8080
<el-dropdown-item
81-
v-if="chatUser.chatUserProfile?.source === 'LOCAL'"
8281
class="border-t"
8382
style="padding-top: 8px; padding-bottom: 8px"
8483
@click="logout"

ui/src/views/system-setting/authentication/component/Setting.vue

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,56 @@
4040
]"
4141
prop="max_attempts"
4242
>
43-
<span style="font-size: 13px;">
43+
<el-row :gutter="16">
44+
<el-col :span="24">
45+
<span style="font-size: 13px;">
4446
{{ $t('views.system.loginFailed') }}
4547
</span>
46-
<el-input-number
47-
style="margin-left: 8px;"
48-
v-model="form.max_attempts"
49-
:min="-1"
50-
:max="10"
51-
:step="1"
52-
controls-position="right"
53-
/>
54-
<span style="margin-left: 8px; font-size: 13px;">
48+
<el-input-number
49+
style="margin-left: 8px;"
50+
v-model="form.max_attempts"
51+
:min="-1"
52+
:max="10"
53+
:step="1"
54+
controls-position="right"
55+
/>
56+
<span style="margin-left: 8px; font-size: 13px;">
5557
{{ $t('views.system.loginFailedMessage') }}
5658
</span>
57-
<span style="margin-left: 8px; color: #909399; font-size: 12px;">
59+
<span style="margin-left: 8px; color: #909399; font-size: 12px;">
5860
({{ $t('views.system.display_codeTip') }})
5961
</span>
62+
</el-col>
63+
64+
<el-col :span="24" style="margin-top: 8px;">
65+
<span style="font-size: 13px;">
66+
{{ $t('views.system.loginFailed') }}
67+
</span>
68+
<el-input-number
69+
style="margin-left: 8px;"
70+
v-model="form.failed_attempts"
71+
:min="-1"
72+
:max="10"
73+
:step="1"
74+
controls-position="right"
75+
/>
76+
<span style="margin-left: 8px; font-size: 13px;">
77+
{{ $t('views.system.loginFailedMessage') }}
78+
</span>
79+
<el-input-number
80+
style="margin-left: 8px;"
81+
v-model="form.lock_time"
82+
:min="-1"
83+
:max="10"
84+
:step="1"
85+
controls-position="right"
86+
/>
87+
<span style="margin-left: 8px; font-size: 13px;">
88+
分钟
89+
</span>
90+
</el-col>
91+
</el-row>
92+
6093
</el-form-item>
6194
</el-form>
6295
<div style="margin-top:16px;">
@@ -93,6 +126,8 @@ const authFormRef = ref<FormInstance>();
93126
const form = ref<any>({
94127
default_value: 'LOCAL',
95128
max_attempts: 1,
129+
failed_attempts: 5,
130+
lock_time: 10,
96131
})
97132
98133
const submit = async (formEl: FormInstance | undefined) => {
@@ -117,6 +152,12 @@ onMounted(() => {
117152
authApi.getLoginSetting().then((res) => {
118153
if (Object.keys(res.data).length > 0) {
119154
form.value = res.data;
155+
if (!form.value.failed_attempts) {
156+
form.value.failed_attempts = 5;
157+
}
158+
if (!form.value.lock_time) {
159+
form.value.lock_time = 10;
160+
}
120161
loginMethods.value = res.data.auth_types
121162
}
122163
})

0 commit comments

Comments
 (0)