From a511d8eddc6f770def069d7c6a4e8b42dd19e536 Mon Sep 17 00:00:00 2001 From: CyberRex Date: Tue, 3 Oct 2023 20:27:37 +0900 Subject: [PATCH] =?UTF-8?q?2=E6=AE=B5=E9=9A=8E=E8=AA=8D=E8=A8=BC=E3=81=AE?= =?UTF-8?q?=E3=83=90=E3=83=83=E3=82=AF=E3=82=A2=E3=83=83=E3=83=97=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E4=B8=80=E8=A6=A7=E3=82=92=E3=83=86=E3=82=AD?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=A7?= =?UTF-8?q?=E3=83=80=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E3=81=AB=20(#11957)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontend/src/pages/settings/2fa.qrdialog.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/frontend/src/pages/settings/2fa.qrdialog.vue b/packages/frontend/src/pages/settings/2fa.qrdialog.vue index c2d1694c5b..4641b49103 100644 --- a/packages/frontend/src/pages/settings/2fa.qrdialog.vue +++ b/packages/frontend/src/pages/settings/2fa.qrdialog.vue @@ -83,6 +83,8 @@ SPDX-License-Identifier: AGPL-3.0-only + + {{ i18n.ts.download }} @@ -108,6 +110,7 @@ import * as os from '@/os.js'; import MkFolder from '@/components/MkFolder.vue'; import MkInfo from '@/components/MkInfo.vue'; import { confetti } from '@/scripts/confetti.js'; +import { $i } from '@/account.js'; defineProps<{ twoFactorData: { @@ -143,6 +146,16 @@ async function tokenDone() { }); } +function downloadBackupCodes() { + if (backupCodes.value !== undefined) { + const txtBlob = new Blob([backupCodes.value.join('\n')], { type: 'text/plain' }); + const dummya = document.createElement('a'); + dummya.href = URL.createObjectURL(txtBlob); + dummya.download = `${$i?.username}-2fa-backup-codes.txt`; + dummya.click(); + } +} + function allDone() { dialog.value.close(); }