Skip to content

Commit afd6bf4

Browse files
committed
fix: do not popup otp modal if user not enable 2fa
1 parent b68e8a1 commit afd6bf4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

app/src/components/OTP/useOTPModal.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ const useOTPModal = () => {
2424
document.head.appendChild(style)
2525
}
2626

27-
const open = ({ onOk, onCancel }: OTPModalProps) => {
27+
const open = async ({ onOk, onCancel }: OTPModalProps) => {
28+
const { status } = await otp.status()
29+
if (!status) {
30+
onOk?.('')
31+
32+
return
33+
}
34+
2835
const cookies = useCookies(['nginx-ui-2fa'])
2936
const ssid = cookies.get('secure_session_id')
3037
if (ssid) {

app/src/views/preference/AuthSettings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ function removeBannedIP(ip: string) {
5555
<template>
5656
<div class="flex justify-center">
5757
<div>
58+
<TOTP class="mb-4" />
59+
5860
<AAlert
5961
class="mb-4"
6062
:message="$gettext('Tips')"
@@ -106,8 +108,6 @@ function removeBannedIP(ip: string) {
106108
</template>
107109
</ATable>
108110
</div>
109-
110-
<TOTP />
111111
</div>
112112
</div>
113113
</template>

0 commit comments

Comments
 (0)