Skip to content

Commit dc2ec6f

Browse files
committed
fix: bypass the password of time limit
1 parent 864c906 commit dc2ec6f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/pages/app/components/Option/components/LimitOption/usePswEdit.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export const usePswEdit = (options: Options) => {
3636
message: (
3737
<ElForm labelWidth={120} labelPosition="left">
3838
<ElFormItem required label={t(msg => msg.option.limit.level.pswFormLabel)}>
39-
<ElInput modelValue={psw.value} onInput={setPsw} />
39+
<ElInput modelValue={psw.value} onInput={setPsw} type='password' />
4040
</ElFormItem>
4141
<ElFormItem required label={t(msg => msg.option.limit.level.pswFormAgain)}>
42-
<ElInput modelValue={confirmPsw.value} onInput={setConfirmPsw} />
42+
<ElInput modelValue={confirmPsw.value} onInput={setConfirmPsw} type='password' />
4343
</ElFormItem>
4444
</ElForm>
4545
),

src/pages/app/components/Option/components/LimitOption/useVerify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const useVerify = (option: timer.option.LimitOption) => {
77

88
const verify = async (): Promise<void> => {
99
if (verified.value) return
10-
const items = await limitService.select({ filterDisabled: true, url: undefined })
10+
const items = await limitService.select()
1111
const triggerResults = await Promise.all((items || []).map(judgeVerificationRequired))
1212
const anyTrigger = triggerResults.some(t => !!t)
1313
if (anyTrigger) {

src/pages/app/util/limit.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { I18nResultItem, locale } from "@i18n"
55
import { getCssVariable } from "@pages/util/style"
66
import verificationProcessor from "@service/limit-service/verification/processor"
77
import { dateMinute2Idx, hasLimited, isEnabledAndEffective } from "@util/limit"
8-
import { ElMessage, ElMessageBox, type ElMessageBoxOptions, useId } from "element-plus"
8+
import { ElMessage, ElMessageBox, type ElMessageBoxOptions, type InputType, useId } from "element-plus"
99
import { defineComponent, onMounted, ref, type VNode } from "vue"
1010

1111
/**
@@ -101,6 +101,7 @@ export function processVerification(option: timer.option.LimitOption, context?:
101101
message: <div>{t(msg => msg.limit.verification.strictTip)}</div>,
102102
}).catch(() => { }))
103103
}
104+
let inputType: InputType | undefined
104105
let answerValue: string | undefined
105106
let messageNode: I18nResultItem<VNode>[] | undefined | I18nResultItem<VNode>
106107
let incorrectMessage: string
@@ -109,6 +110,7 @@ export function processVerification(option: timer.option.LimitOption, context?:
109110
answerValue = limitPassword
110111
messageNode = t(msg => msg.limit.verification.pswInputTip)
111112
incorrectMessage = t(msg => msg.limit.verification.incorrectPsw)
113+
inputType = 'password'
112114
} else if (limitLevel === 'verification') {
113115
const pair = verificationProcessor.generate(limitVerifyDifficulty ?? 'easy', locale)
114116
const { prompt, promptParam, answer, second = 60 } = pair || {}
@@ -138,6 +140,7 @@ export function processVerification(option: timer.option.LimitOption, context?:
138140
title: '',
139141
message: <div style={{ userSelect: 'none' }}>{messageNode}</div>,
140142
showInput: true,
143+
inputType,
141144
showCancelButton: true,
142145
showClose: false,
143146
confirmButtonText: countdown ? btnText(countdown) : okBtnTxt,

0 commit comments

Comments
 (0)