From 6b5dbe7c1e32a1413e749d2578635540b13cf141 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 25 Jul 2024 02:42:36 +0200 Subject: [PATCH] [#339] Frontend implementation of the new 2FA logic. Closes: #339 --- README.md | 11 + .../http/webapp/src/components/Modal.vue | 4 + .../src/components/panels/Settings/Otp.vue | 468 ++++++++++++++++++ .../src/components/panels/Settings/Users.vue | 99 +++- .../backend/http/webapp/src/views/Login.vue | 51 +- 5 files changed, 617 insertions(+), 16 deletions(-) create mode 100644 platypush/backend/http/webapp/src/components/panels/Settings/Otp.vue diff --git a/README.md b/README.md index 42309e79..36d1f87c 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ * [Other Web panels](#other-web-panels) * [Dashboards](#dashboards) * [PWA support](#pwa-support) +- [Two-factor authentication](#two-factor-authentication) - [Mobile app](#mobile-app) - [Browser extension](#browser-extension) - [Tests](#tests) @@ -1247,6 +1248,16 @@ PWA (progressive web app) to work. The Platypush PWA allows you to install a Platypush native-like client on your mobile devices if you don't want to use the full Android app. +## Two-factor authentication + +Support for 2FA over OTP codes requires to enable the +[`otp`](https://docs.platypush.tech/platypush/plugins/otp.html) and +[`qrcode`](https://docs.platypush.tech/platypush/plugins/qrcode.html) plugins. + +After installing the dependencies, you can enable it by navigating to +_Settings_ -> _Users_ from the Web panel. Then select your user, choose _Set up +2FA_ and proceed with the steps on screen to set up your authenticator. + ## Mobile app An [official Android diff --git a/platypush/backend/http/webapp/src/components/Modal.vue b/platypush/backend/http/webapp/src/components/Modal.vue index 0984f6e2..8f16f726 100644 --- a/platypush/backend/http/webapp/src/components/Modal.vue +++ b/platypush/backend/http/webapp/src/components/Modal.vue @@ -89,6 +89,10 @@ export default { this.isVisible = true }, + open() { + this.show() + }, + toggle() { if (this.isVisible) this.close() diff --git a/platypush/backend/http/webapp/src/components/panels/Settings/Otp.vue b/platypush/backend/http/webapp/src/components/panels/Settings/Otp.vue new file mode 100644 index 00000000..99174480 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Settings/Otp.vue @@ -0,0 +1,468 @@ +