oauth添加二次认证

This commit is contained in:
lijun 2025-10-22 20:09:32 +08:00
parent d8b3f2b492
commit 682f1b06b9
1 changed files with 28 additions and 17 deletions

View File

@ -96,7 +96,8 @@
</el-select> </el-select>
<el-row> <el-row>
<span>输入验证码</span> <span>输入验证码</span>
<el-input placeholder="请输入验证码" style="width: 100%; margin-top: 20px;" v-model="second_auth_code" v-if="second_auth_method == 'TOTP'"> <el-input placeholder="请输入验证码" style="width: 100%; margin-top: 20px;" v-model="second_auth_code"
v-if="second_auth_method == 'TOTP'">
<template #prepend> <template #prepend>
<el-icon> <el-icon>
<Lock /> <Lock />
@ -104,20 +105,17 @@
</template> </template>
</el-input> </el-input>
<el-input v-model="code_login_form.code" placeholder="请输入验证码" v-if="second_auth_method == 'EMAIL'"> <el-input v-model="code_login_form.code" placeholder="请输入验证码" v-if="second_auth_method == 'EMAIL'">
<template #prepend> <template #prepend>
<el-icon><VerificationCode /></el-icon> <el-icon>
</template> <VerificationCode />
<template #append> </el-icon>
<el-button </template>
type="text" <template #append>
:disabled="countdown > 0" <el-button type="text" :disabled="countdown > 0" @click="sendCode" class="code-btn">
@click="sendCode" {{ countdown > 0 ? `${countdown}s后重发` : "发送验证码" }}
class="code-btn" </el-button>
> </template>
{{ countdown > 0 ? `${countdown}s后重发` : "发送验证码" }} </el-input>
</el-button>
</template>
</el-input>
</el-row> </el-row>
<el-row> <el-row>
@ -349,9 +347,22 @@ const thirdLogin = async (type) => {
return; return;
} }
let statusResp = await getThirdPartyLoginStatus({ uuid: uuid, host_id: loginData.value.fingerprint }); let statusResp = await getThirdPartyLoginStatus({ uuid: uuid, host_id: loginData.value.fingerprint });
if (statusResp["code"] !== 0) { if (statusResp["code"] == 1102) {
ElMessage.error("获取登录状态失败!请稍后再试");
clearInterval(timer.value); clearInterval(timer.value);
ElMessage.error(statusResp["message"]);
//
second_auth_visible.value = true;
second_auth_state_key.value = statusResp["data"]["state"];
let types = statusResp["data"]["type"];
second_auth_type_list.value = types.split(",");
//''
second_auth_type_list.value = second_auth_type_list.value.filter(item => item);
second_auth_method.value = second_auth_type_list.value[0];
//console.log("second_auth_type_list:", second_auth_type_list.value);
return;
} else if (statusResp["code"] != 0) {
ElMessage.error(statusResp["message"] || "该账号已被禁用,请联系管理员!");
return; return;
} }
if (statusResp["code"] === 9) { if (statusResp["code"] === 9) {