1
0
Fork 1
mirror of https://example.com synced 2024-11-22 12:16:40 +09:00

fix(frontend): allow disabling of 2fa when security key is registered

This commit is contained in:
TrojanerHD 2024-02-24 02:21:17 +01:00 committed by naskya
parent 2c78c01d57
commit 437d02ef5d
Signed by: naskya
GPG key ID: 712D413B3A9FED5C

View file

@ -14,17 +14,7 @@
<template #caption>{{ i18n.ts.totpDescription }}</template>
<div v-if="$i.twoFactorEnabled" class="_gaps_s">
<div v-text="i18n.ts._2fa.alreadyRegistered" />
<template v-if="$i.securityKeysList.length > 0">
<MkButton @click="renewTOTP"
><i
:class="icon('ph-shield-check')"
style="margin-inline-end: 0.5rem"
></i
>{{ i18n.ts._2fa.renewTOTP }}</MkButton
>
<MkInfo>{{ i18n.ts._2fa.whyTOTPOnlyRenew }}</MkInfo>
</template>
<MkButton v-else @click="unregisterTOTP"
<MkButton @click="unregisterTOTP"
><i
:class="icon('ph-shield-slash')"
style="margin-inline-end: 0.5rem"
@ -198,19 +188,6 @@ function unregisterTOTP() {
});
}
function renewTOTP() {
os.confirm({
type: "question",
title: i18n.ts._2fa.renewTOTP,
text: i18n.ts._2fa.renewTOTPConfirm,
okText: i18n.ts._2fa.renewTOTPOk,
cancelText: i18n.ts._2fa.renewTOTPCancel,
}).then(({ canceled }) => {
if (canceled) return;
registerTOTP();
});
}
async function unregisterKey(key) {
const confirm = await os.confirm({
type: "question",