This commit is contained in:
jxxghp
2024-04-02 16:36:27 +08:00
parent ce0dda0455
commit 8b4b79fa10
3 changed files with 15 additions and 15 deletions

View File

@@ -851,7 +851,7 @@ export interface User {
// 头像
avatar: string
// 是否开启二次验证
// 是否开启双重验证
is_otp: boolean
}

View File

@@ -31,7 +31,7 @@ const backgroundImageUrl = ref('')
// 背景图片加载状态
const isImageLoaded = ref(false)
// 是否开启二次验证
// 是否开启双重验证
const isOTP = ref(false)
// 用户名称输入框
@@ -49,7 +49,7 @@ async function fetchBackgroundImage() {
})
}
// 查询是否开启二次验证
// 查询是否开启双重验证
async function fetchOTP() {
const userid = usernameInput.value?.value
if (!userid) {
@@ -111,13 +111,13 @@ function login() {
if (!error.response)
errorMessage.value = '登录失败,请检查网络连接'
else if (error.response.status === 401)
errorMessage.value = '登录失败,请检查用户名、密码或二次验证是否正确'
errorMessage.value = '登录失败,请检查用户名、密码或双重验证是否正确'
else if (error.response.status === 403)
errorMessage.value = '登录失败,您没有权限访问'
else if (error.response.status === 500)
errorMessage.value = '登录失败,服务器错误'
else
errorMessage.value = `登录失败 ${error.response.status},请检查用户名、密码或二次验证码是否正确`
errorMessage.value = `登录失败 ${error.response.status},请检查用户名、密码或双重验证码是否正确`
})
}
@@ -199,7 +199,7 @@ onMounted(() => {
<VTextField
v-if="isOTP"
v-model="form.otp_password"
label="二次验证码"
label="双重验证码"
type="input"
/>
<!-- remember me checkbox -->

View File

@@ -21,7 +21,7 @@ const refInputEl = ref<HTMLElement>()
// 新增用户窗口
const addUserDialog = ref(false)
// 开启二次验证窗口
// 开启双重验证窗口
const otpDialog = ref(false)
// otp uri
@@ -30,7 +30,7 @@ const otpUri = ref('')
// otp secret
const secret = ref('')
// 确认二次验证密码
// 确认双重验证密码
const otpPassword = ref('')
// 新增用户表单
@@ -204,13 +204,13 @@ async function getOtpUri() {
}
}
// 关闭当前用户的二次验证
// 关闭当前用户的双重验证
async function disableOtp() {
try {
const result: { [key: string]: any } = await api.post('user/otp/disable')
if (result.success) {
accountInfo.value.is_otp = false
$toast.success('关闭登录二次验证成功!')
$toast.success('关闭登录双重验证成功!')
}
else {
$toast.error(`关闭otp失败${result.message}`)
@@ -231,7 +231,7 @@ async function judgeOtpPassword() {
const result: { [key: string]: any } = await api.post('user/otp/judge', { uri: otpUri.value, otpPassword: otpPassword.value })
if (result.success) {
$toast.success('开启登录二次验证成功!')
$toast.success('开启登录双重验证成功!')
otpDialog.value = false
accountInfo.value.is_otp = true
}
@@ -306,7 +306,7 @@ onMounted(() => {
<VIcon
icon="mdi-account-key"
/>
<span class="d-none d-sm-block ms-2">{{ accountInfo.is_otp ? "关闭验证" : "二次验证" }}</span>
<span class="d-none d-sm-block ms-2">{{ accountInfo.is_otp ? "关闭验证" : "双重验证" }}</span>
</VBtn>
</div>
@@ -555,19 +555,19 @@ onMounted(() => {
</VCard>
</VDialog>
<!-- 二次验证弹窗 -->
<!-- 双重验证弹窗 -->
<VDialog
v-model="otpDialog"
max-width="45rem"
persistent
z-index="1010"
>
<!-- 开启二次验证弹窗内容 -->
<!-- 开启双重验证弹窗内容 -->
<VCard>
<DialogCloseBtn @click="otpDialog = false" />
<VCardText>
<h4 class="text-h4 text-center mb-6 mt-5">
登录二次验证
登录双重验证
</h4><h5 class="text-h5 font-weight-medium mb-2">
身份验证器
</h5>