From 399eaf57093bec3064c08089216698035eb98e08 Mon Sep 17 00:00:00 2001 From: Spitap Date: Tue, 20 Jun 2023 10:26:56 +0200 Subject: [PATCH] generate qrcode on frontend, added manual key copy --- frontend/package.json | 3 +- frontend/src/api/account.js | 4 +- .../src/components/user/TwoFactorAuthForm.vue | 59 +++++++++++++++---- frontend/yarn.lock | 5 ++ modoboa/core/api/v2/viewsets.py | 16 ++--- 5 files changed, 62 insertions(+), 25 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index dec25024e..5aacece55 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -23,7 +23,8 @@ "vue-gettext": "^2.1.12", "vue-router": "^3.2.0", "vuetify": "^2.6.10", - "vuex": "^3.4.0" + "vuex": "^3.4.0", + "qrcode.vue": "~1.7.0" }, "devDependencies": { "@babel/core": "^7.12.16", diff --git a/frontend/src/api/account.js b/frontend/src/api/account.js index 07e631b57..e9617d813 100644 --- a/frontend/src/api/account.js +++ b/frontend/src/api/account.js @@ -16,8 +16,8 @@ export default { startTFASetup () { return repository.post(`${resource}/tfa/setup/`) }, - getQRCodeForTFASetup () { - return repository.get(`${resource}/tfa/setup/qr_code/`) + getKeyForTFASetup () { + return repository.get(`${resource}/tfa/setup/key/`) }, finalizeTFASetup (pinCode) { const payload = { pin_code: pinCode } diff --git a/frontend/src/components/user/TwoFactorAuthForm.vue b/frontend/src/components/user/TwoFactorAuthForm.vue index 7bf933c34..48d66b4ec 100644 --- a/frontend/src/components/user/TwoFactorAuthForm.vue +++ b/frontend/src/components/user/TwoFactorAuthForm.vue @@ -5,10 +5,29 @@ Two factor authentication -