mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-12 02:20:12 +08:00
83 lines
2.2 KiB
Vue
83 lines
2.2 KiB
Vue
<script setup>
|
|
import { onMounted, ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { useRouter } from 'vue-router'
|
|
|
|
import { useGlobalState } from '../../store'
|
|
import { api } from '../../api'
|
|
|
|
const { userJwt, userSettings, } = useGlobalState()
|
|
const router = useRouter()
|
|
const message = useMessage()
|
|
|
|
const showLogout = ref(false)
|
|
|
|
const { t } = useI18n({
|
|
messages: {
|
|
en: {
|
|
logout: 'Logout',
|
|
logoutConfirm: 'Are you sure you want to logout?',
|
|
passordTip: 'The server will only receive the hash value of the password, and will not receive the plaintext password, so it cannot view or retrieve your password. If the administrator enables email verification, you can reset the password in incognito mode',
|
|
},
|
|
zh: {
|
|
logout: '退出登录',
|
|
logoutConfirm: '确定要退出登录吗?',
|
|
passordTip: '服务器只会接收到密码的哈希值,不会接收到明文密码,因此无法查看或者找回您的密码, 如果管理员启用了邮件验证您可以在无痕模式重置密码',
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
const logout = async () => {
|
|
userJwt.value = '';
|
|
location.reload()
|
|
}
|
|
|
|
const fetchData = async () => {
|
|
}
|
|
|
|
onMounted(async () => {
|
|
await fetchData()
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="center" v-if="userSettings.user_email">
|
|
<n-card :bordered="false" embedded>
|
|
<n-alert :show-icon="false" :bordered="false">
|
|
<span>
|
|
{{ t('passordTip') }}
|
|
</span>
|
|
</n-alert>
|
|
<n-button @click="showLogout = true" secondary block strong>
|
|
{{ t('logout') }}
|
|
</n-button>
|
|
</n-card>
|
|
<n-modal v-model:show="showLogout" preset="dialog" :title="t('logout')">
|
|
<p>{{ t('logoutConfirm') }}</p>
|
|
<template #action>
|
|
<n-button :loading="loading" @click="logout" size="small" tertiary type="primary">
|
|
{{ t('logout') }}
|
|
</n-button>
|
|
</template>
|
|
</n-modal>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.center {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
|
|
.n-card {
|
|
max-width: 800px;
|
|
text-align: left;
|
|
}
|
|
|
|
.n-button {
|
|
margin-top: 10px;
|
|
}
|
|
</style>
|