mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-04 23:17:34 +08:00
fix: UI admin page show modal when no need password (#419)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import { useGlobalState } from '../store'
|
import { useGlobalState } from '../store'
|
||||||
@@ -30,6 +30,7 @@ const message = useMessage()
|
|||||||
|
|
||||||
const authFunc = async () => {
|
const authFunc = async () => {
|
||||||
try {
|
try {
|
||||||
|
adminAuth.value = tmpAdminAuth.value;
|
||||||
location.reload()
|
location.reload()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(error.message || "error");
|
message.error(error.message || "error");
|
||||||
@@ -85,22 +86,21 @@ const { t } = useI18n({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const showAdminPasswordModal = computed(() => !showAdminPage.value || showAdminAuth.value)
|
||||||
|
const tmpAdminAuth = ref('')
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// make sure user_id is fetched
|
// make sure user_id is fetched
|
||||||
if (!userSettings.value.user_id) await api.getUserSettings(message);
|
if (!userSettings.value.user_id) await api.getUserSettings(message);
|
||||||
if (!showAdminPage.value) {
|
|
||||||
showAdminAuth.value = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<n-modal v-model:show="showAdminAuth" :closable="false" :closeOnEsc="false" :maskClosable="false" preset="dialog"
|
<n-modal v-model:show="showAdminPasswordModal" :closable="false" :closeOnEsc="false" :maskClosable="false"
|
||||||
:title="t('accessHeader')">
|
preset="dialog" :title="t('accessHeader')">
|
||||||
<p>{{ t('accessTip') }}</p>
|
<p>{{ t('accessTip') }}</p>
|
||||||
<n-input v-model:value="adminAuth" type="textarea" :autosize="{ minRows: 3 }" />
|
<n-input v-model:value="tmpAdminAuth" type="password" show-password-on="click" />
|
||||||
<template #action>
|
<template #action>
|
||||||
<n-button @click="authFunc" type="primary" :loading="loading">
|
<n-button @click="authFunc" type="primary" :loading="loading">
|
||||||
{{ t('ok') }}
|
{{ t('ok') }}
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ onMounted(async () => {
|
|||||||
<n-modal v-model:show="showAuth" :closable="false" :closeOnEsc="false" :maskClosable="false" preset="dialog"
|
<n-modal v-model:show="showAuth" :closable="false" :closeOnEsc="false" :maskClosable="false" preset="dialog"
|
||||||
:title="t('accessHeader')">
|
:title="t('accessHeader')">
|
||||||
<p>{{ t('accessTip') }}</p>
|
<p>{{ t('accessTip') }}</p>
|
||||||
<n-input v-model:value="auth" type="textarea" :autosize="{ minRows: 3 }" />
|
<n-input v-model:value="auth" type="password" show-password-on="click" />
|
||||||
<template #action>
|
<template #action>
|
||||||
<n-button :loading="loading" @click="authFunc" type="primary">
|
<n-button :loading="loading" @click="authFunc" type="primary">
|
||||||
{{ t('ok') }}
|
{{ t('ok') }}
|
||||||
|
|||||||
Reference in New Issue
Block a user