This commit is contained in:
syuilo 2023-08-28 16:46:12 +09:00
parent 6ce0b8d10b
commit df6c006515
2 changed files with 8 additions and 10 deletions

View File

@ -54,9 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new Error('not verified');
}
const backupCodes = Array.from({ length: 20 }, () => {
return new OTPAuth.Secret().base32;
});
const backupCodes = Array.from({ length: 5 }, () => new OTPAuth.Secret().base32);
await this.userProfilesRepository.update(me.id, {
twoFactorSecret: profile.twoFactorTempSecret,

View File

@ -33,10 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<a href="https://support.google.com/accounts/answer/1066447" rel="noopener" target="_blank" class="_link">Google Authenticator</a>
</template>
</I18n>
<div>
{{ i18n.ts._2fa.step2 }}<br>
{{ i18n.ts._2fa.step2Click }}
</div>
<div>{{ i18n.ts._2fa.step2 }}<br>{{ i18n.ts._2fa.step2Click }}</div>
<a :href="twoFactorData.url"><img :class="$style.qr" :src="twoFactorData.qr"></a>
<MkKeyValue :copy="twoFactorData.url">
<template #key>{{ i18n.ts._2fa.step2Uri }}</template>
@ -80,9 +77,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps">
<MkInfo warn>{{ i18n.ts._2fa.backupCodesDescription }}</MkInfo>
<ul v-for="code in backupCodes" :key="code" class="_gaps_s" style="margin: 0;">
<li class="_monospace">{{ code }}</li>
</ul>
<div v-for="(code, i) in backupCodes" :key="code" class="_gaps_s">
<MkKeyValue :copy="code">
<template #key>#{{ i + 1 }}</template>
<template #value><code class="_monospace">{{ code }}</code></template>
</MkKeyValue>
</div>
</div>
</MkFolder>
</div>