fix: 🛂 no longer need 2fa for webauthn

This commit is contained in:
ThatOneCalculator 2023-04-01 21:04:15 -07:00
parent ba8041d333
commit 342ed96b6c
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
3 changed files with 9 additions and 6 deletions

View File

@ -32,9 +32,9 @@ export default define(meta, paramDef, async (ps, user) => {
throw new Error("incorrect password");
}
if (!profile.twoFactorEnabled) {
throw new Error("2fa not enabled");
}
// if (!profile.twoFactorEnabled) {
// throw new Error("2fa not enabled");
// }
// 32 byte challenge
const entropy = await randomBytes(32);

View File

@ -13,6 +13,7 @@
<MkLoading v-else-if="type === 'waiting'" :class="$style.iconInner" :em="true"/>
</div>
<header v-if="title" :class="$style.title"><Mfm :text="title"/></header>
<header v-if="title == null && input.type === 'password'" :class="$style.title"><Mfm :text="i18n.ts.password"/></header>
<div v-if="text" :class="$style.text"><Mfm :text="text"/></div>
<MkInput v-if="input && input.type !== 'paragraph'" v-model="inputValue" autofocus :type="input.type || 'text'" :placeholder="input.placeholder || undefined" @keydown="onInputKeydown">
<template v-if="input.type === 'password'" #prefix><i class="ph-password ph-bold ph-lg"></i></template>

View File

@ -4,7 +4,9 @@
<template v-if="$i.twoFactorEnabled">
<p>{{ i18n.ts._2fa.alreadyRegistered }}</p>
<MkButton @click="unregister">{{ i18n.ts.unregister }}</MkButton>
</template>
<template>
<template v-if="supportsCredentials">
<hr class="totp-method-sep">
@ -20,7 +22,7 @@
<MkSwitch v-if="$i.securityKeysList.length > 0" v-model="usePasswordLessLogin" @update:modelValue="updatePasswordLessLogin">{{ i18n.ts.passwordLessLogin }}</MkSwitch>
<MkInfo v-if="registration && registration.error" warn>{{ i18n.ts.error }} {{ registration.error }}</MkInfo>
<MkInfo v-if="registration && registration.error" style="margin-bottom: 1rem;" warn>{{ i18n.ts.error }}: {{ registration.error }}</MkInfo>
<MkButton v-if="!registration || registration.error" @click="addSecurityKey">{{ i18n.ts._2fa.registerKey }}</MkButton>
<ol v-if="registration && !registration.error">
@ -45,7 +47,7 @@
<li>
<I18n :src="i18n.ts._2fa.step1" tag="span">
<template #a>
<a href="https://authy.com/" rel="noopener" target="_blank" class="_link">Authy</a>
<a href="https://authpass.app/" rel="noopener" target="_blank" class="_link">AuthPass</a>
</template>
<template #b>
<a href="https://support.google.com/accounts/answer/1066447" rel="noopener" target="_blank" class="_link">Google Authenticator</a>
@ -140,7 +142,7 @@ function registerKey() {
attestationObject: hexify(registration.value.credential.response.attestationObject)
}).then(key => {
registration.value = null;
key.lastUsed = new Date();
key!.lastUsed = new Date();
os.success();
});
}