mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 07:28:37 +08:00
feat:OTP默认不显示
This commit is contained in:
+36
-12
@@ -31,6 +31,12 @@ const backgroundImageUrl = ref('')
|
|||||||
// 背景图片加载状态
|
// 背景图片加载状态
|
||||||
const isImageLoaded = ref(false)
|
const isImageLoaded = ref(false)
|
||||||
|
|
||||||
|
// 是否开启二次验证
|
||||||
|
const isOTP = ref(false)
|
||||||
|
|
||||||
|
// 用户名称输入框
|
||||||
|
const usernameInput = ref()
|
||||||
|
|
||||||
// 获取背景图片
|
// 获取背景图片
|
||||||
async function fetchBackgroundImage() {
|
async function fetchBackgroundImage() {
|
||||||
api
|
api
|
||||||
@@ -43,6 +49,23 @@ async function fetchBackgroundImage() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询是否开启二次验证
|
||||||
|
async function fetchOTP() {
|
||||||
|
const userid = usernameInput.value?.value
|
||||||
|
if (!userid) {
|
||||||
|
isOTP.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
api
|
||||||
|
.get(`/user/otp/${userid}`)
|
||||||
|
.then((response: any) => {
|
||||||
|
isOTP.value = response.success
|
||||||
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 登录获取token事件
|
// 登录获取token事件
|
||||||
function login() {
|
function login() {
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
@@ -150,13 +173,14 @@ onMounted(() => {
|
|||||||
<!-- username -->
|
<!-- username -->
|
||||||
<VCol cols="12">
|
<VCol cols="12">
|
||||||
<VTextField
|
<VTextField
|
||||||
|
ref="usernameInput"
|
||||||
v-model="form.username"
|
v-model="form.username"
|
||||||
label="用户名"
|
label="用户名"
|
||||||
type="text"
|
type="text"
|
||||||
:rules="[requiredValidator]"
|
:rules="[requiredValidator]"
|
||||||
|
@input="fetchOTP"
|
||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
<!-- password -->
|
<!-- password -->
|
||||||
<VCol cols="12">
|
<VCol cols="12">
|
||||||
<VTextField
|
<VTextField
|
||||||
@@ -169,30 +193,24 @@ onMounted(() => {
|
|||||||
:rules="[requiredValidator]"
|
:rules="[requiredValidator]"
|
||||||
@click:append-inner="isPasswordVisible = !isPasswordVisible"
|
@click:append-inner="isPasswordVisible = !isPasswordVisible"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="errorMessage"
|
|
||||||
class="text-error mt-1"
|
|
||||||
>
|
|
||||||
{{ errorMessage }}
|
|
||||||
</div>
|
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol cols="12">
|
<VCol cols="12">
|
||||||
<VTextField
|
<VTextField
|
||||||
|
v-if="isOTP"
|
||||||
v-model="form.otp_password"
|
v-model="form.otp_password"
|
||||||
hint="非必须,如开启二次验证需填写"
|
label="二次验证码"
|
||||||
label="二次验证"
|
|
||||||
type="input"
|
type="input"
|
||||||
/>
|
/>
|
||||||
<!-- remember me checkbox -->
|
<!-- remember me checkbox -->
|
||||||
<div class="d-flex align-center justify-space-between flex-wrap mt-1 mb-4">
|
<div class="d-flex align-center justify-space-between flex-wrap">
|
||||||
<VCheckbox
|
<VCheckbox
|
||||||
v-model="form.remember"
|
v-model="form.remember"
|
||||||
label="保持登录"
|
label="保持登录"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12">
|
||||||
<!-- login button -->
|
<!-- login button -->
|
||||||
<VBtn
|
<VBtn
|
||||||
block
|
block
|
||||||
@@ -201,6 +219,12 @@ onMounted(() => {
|
|||||||
>
|
>
|
||||||
登录
|
登录
|
||||||
</VBtn>
|
</VBtn>
|
||||||
|
<div
|
||||||
|
v-if="errorMessage"
|
||||||
|
class="text-error mt-2"
|
||||||
|
>
|
||||||
|
{{ errorMessage }}
|
||||||
|
</div>
|
||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
</VForm>
|
</VForm>
|
||||||
|
|||||||
Reference in New Issue
Block a user