fix: do not popup otp modal if user not enable 2fa

This commit is contained in:
Jacky 2024-07-23 22:22:11 +08:00
parent b68e8a1403
commit afd6bf4268
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
2 changed files with 10 additions and 3 deletions

View file

@ -24,7 +24,14 @@ const useOTPModal = () => {
document.head.appendChild(style)
}
const open = ({ onOk, onCancel }: OTPModalProps) => {
const open = async ({ onOk, onCancel }: OTPModalProps) => {
const { status } = await otp.status()
if (!status) {
onOk?.('')
return
}
const cookies = useCookies(['nginx-ui-2fa'])
const ssid = cookies.get('secure_session_id')
if (ssid) {

View file

@ -55,6 +55,8 @@ function removeBannedIP(ip: string) {
<template>
<div class="flex justify-center">
<div>
<TOTP class="mb-4" />
<AAlert
class="mb-4"
:message="$gettext('Tips')"
@ -106,8 +108,6 @@ function removeBannedIP(ip: string) {
</template>
</ATable>
</div>
<TOTP />
</div>
</div>
</template>