You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ha...@apache.org on 2022/10/26 20:22:29 UTC

[cloudstack] 13/17: 2FA setup at user page

This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch 2FA
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 3a107b296fb0050d7efc1b176b61c10669773710
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Wed Oct 26 07:14:36 2022 +0530

    2FA setup at user page
---
 ui/package-lock.json              | 20 ++++++++++++++++++++
 ui/package.json                   |  4 +++-
 ui/public/locales/en.json         |  7 +++++++
 ui/src/config/section/user.js     |  9 +++++++++
 ui/src/core/lazy_lib/icons_use.js |  2 ++
 ui/src/store/modules/user.js      |  3 +++
 6 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/ui/package-lock.json b/ui/package-lock.json
index 8ae7034a544..6ae1e0367d5 100644
--- a/ui/package-lock.json
+++ b/ui/package-lock.json
@@ -18596,6 +18596,11 @@
       "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
       "dev": true
     },
+    "qrious": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/qrious/-/qrious-4.0.2.tgz",
+      "integrity": "sha512-xWPJIrK1zu5Ypn898fBp8RHkT/9ibquV2Kv24S/JY9VYEhMBMKur1gHVsOiNUh7PHP9uCgejjpZUHUIXXKoU/g=="
+    },
     "qs": {
       "version": "6.5.3",
       "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
@@ -22530,6 +22535,21 @@
         "loader-utils": "^2.0.0"
       }
     },
+    "vue-qrious": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/vue-qrious/-/vue-qrious-3.1.0.tgz",
+      "integrity": "sha512-qC5jw94b/VbUHFxYfumwqhSXKBJNEmaimhpwEmudqOiORMd5yPCFn/mPInnP5nWobvhvcV+S+U3Ger6w2dLyfQ==",
+      "requires": {
+        "tslib": "^2.4.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "2.4.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
+          "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
+        }
+      }
+    },
     "vue-router": {
       "version": "4.0.14",
       "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.14.tgz",
diff --git a/ui/package.json b/ui/package.json
index e27ec671fa1..31ad8bd9d3e 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -53,16 +53,18 @@
     "moment": "^2.26.0",
     "npm-check-updates": "^6.0.1",
     "nprogress": "^0.2.0",
+    "qrious": "^4.0.2",
     "vue": "^3.2.31",
     "vue-chartjs": "^4.0.7",
     "vue-clipboard2": "^0.3.1",
     "vue-cropper": "^1.0.2",
     "vue-i18n": "^9.1.6",
     "vue-loader": "^16.2.0",
+    "vue-qrious": "^3.1.0",
     "vue-router": "^4.0.14",
+    "vue-uuid": "^3.0.0",
     "vue-web-storage": "^6.1.0",
     "vue3-clipboard": "^1.0.0",
-    "vue-uuid": "^3.0.0",
     "vuedraggable": "^4.0.3",
     "vuex": "^4.0.0-0"
   },
diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index 0737f630411..c118c1f57da 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -136,6 +136,7 @@
 "label.action.reboot.systemvm": "Reboot system VM",
 "label.action.recover.volume": "Recover volume",
 "label.action.recurring.snapshot": "Recurring snapshots",
+"label.action.register.2FA.user.auth": "Register user for 2FA authentication",
 "label.action.register.iso": "Register ISO",
 "label.action.register.template": "Register template from URL",
 "label.action.release.ip": "Release IP",
@@ -408,6 +409,7 @@
 "label.compute.offerings": "Compute offerings",
 "label.configuration": "Configuration",
 "label.configure": "Configure",
+"label.configure.app": "Configure the App",
 "label.configure.ldap": "Configure LDAP",
 "label.configure.ovs": "Configure Ovs",
 "label.configure.sticky.policy": "Configure sticky policy",
@@ -675,6 +677,7 @@
 "label.endipv6": "IPv6 end IP",
 "label.endpoint": "Endpoint",
 "label.endport": "End port",
+"label.enter.code": "Enter 6-digit code",
 "label.enter.token": "Enter token",
 "label.error": "Error",
 "label.error.caught": "Error caught",
@@ -1732,6 +1735,7 @@
 "label.transportzoneuuid": "Transport zone UUID",
 "label.try.again": "Try again",
 "label.tuesday": "Tuesday",
+"label.two.factor.secret": "Your Two-factor secret",
 "label.type": "Type",
 "label.type.id": "Type ID",
 "label.ucs": "UCS",
@@ -2578,6 +2582,9 @@
 "message.tooltip.reserved.system.netmask": "The network prefix that defines the pod subnet. Uses CIDR notation.",
 "message.traffic.type.to.basic.zone": "traffic type to basic zone",
 "message.two.fa.auth": "Open the two-factor authentication app on your mobile device to view your authentication code",
+"message.two.fa.auth.register.account": "Open the two-factor authentication application and scan the QR code add the user account",
+"message.two.fa.static.pin.part1": "If you can't scan the QR code, ",
+"message.two.fa.static.pin.part2": "enter this text code",
 "message.update.ipaddress.processing": "Updating IP Address...",
 "message.update.resource.count": "Please confirm that you want to update resource counts for this account.",
 "message.update.resource.count.domain": "Please confirm that you want to update resource counts for this domain.",
diff --git a/ui/src/config/section/user.js b/ui/src/config/section/user.js
index e17e998179e..5a298134839 100644
--- a/ui/src/config/section/user.js
+++ b/ui/src/config/section/user.js
@@ -106,6 +106,15 @@ export default {
       },
       component: shallowRef(defineAsyncComponent(() => import('@/views/iam/ConfigureSamlSsoAuth.vue')))
     },
+    {
+      // update API name
+      api: 'updateUser',
+      icon: 'scan-outlined',
+      label: 'label.action.register.2FA.user.auth',
+      dataView: true,
+      popup: true,
+      component: shallowRef(defineAsyncComponent(() => import('@/views/iam/RegisterTwoFactorAuth.vue')))
+    },
     {
       api: 'deleteUser',
       icon: 'delete-outlined',
diff --git a/ui/src/core/lazy_lib/icons_use.js b/ui/src/core/lazy_lib/icons_use.js
index 82ba4378b62..39627ed76ef 100644
--- a/ui/src/core/lazy_lib/icons_use.js
+++ b/ui/src/core/lazy_lib/icons_use.js
@@ -138,6 +138,7 @@ import {
   SaveOutlined,
   ScheduleOutlined,
   ScissorOutlined,
+  ScanOutlined,
   SearchOutlined,
   SettingOutlined,
   ShareAltOutlined,
@@ -284,6 +285,7 @@ export default {
     app.component('SafetyOutlined', SafetyOutlined)
     app.component('SaveOutlined', SaveOutlined)
     app.component('ScheduleOutlined', ScheduleOutlined)
+    app.component('ScanOutlined', ScanOutlined)
     app.component('ScissorOutlined', ScissorOutlined)
     app.component('SearchOutlined', SearchOutlined)
     app.component('SettingOutlined', SettingOutlined)
diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js
index 859f5e01d0a..262ac7676aa 100644
--- a/ui/src/store/modules/user.js
+++ b/ui/src/store/modules/user.js
@@ -393,6 +393,9 @@ const user = {
     },
     SetDarkMode ({ commit }, darkMode) {
       commit('SET_DARK_MODE', darkMode)
+    },
+    SetLoginFlag ({ commit }, loggedIn) {
+      commit('SET_LOGIN_FLAG', loggedIn)
     }
   }
 }