diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 79c54e57..0e1ef999 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -195,13 +195,15 @@ todo: 2fa is going to be an absolute must have pretty soon, look into what's inv SIGN UP (copied a bit from digital ocean) User settings has a SECURITY section where control 2fa stuff - user enables at which point a secret key for 2fa is generated and stored in the User account + user chooses 2fa button to setup, a dialog pops up sends a request to server at which point a secret key for 2fa is generated and stored in the User account + and gets back the secret to display in a qr code on screen to searching + /auth/setup-hotp user is redirected to a client form with the qr code displayed for teh secret User gets QR code then displayed to sign up with auth software User has to enter a valid code to save or enable 2fa fully otherwise it's not enabled if they cancel out until the correct code is entered it will not be enabled yet If user moves out of 2fa area without validating then it generates a new secret next time they go In - + DISABLE user goes to user settings->Security and click on disable 2fa button which is only enabled to click when the account has 2fa already enabled this removes the 2fa secret from their account and sets 2fa off. diff --git a/ayanova/src/api/authutil.js b/ayanova/src/api/authutil.js index b9d56cff..00a0a686 100644 --- a/ayanova/src/api/authutil.js +++ b/ayanova/src/api/authutil.js @@ -55,7 +55,8 @@ export function processLogin(authResponse, loggedInWithKnownPassword) { userName: authResponse.name, roles: authResponse.roles, userType: authResponse.usertype, - dlt: authResponse.dlt + dlt: authResponse.dlt, + tfaEnabled: authResponse.tfa }); //log the login window.$gz.store.commit( diff --git a/ayanova/src/router.js b/ayanova/src/router.js index 7a4524a4..c4eb4cb5 100644 --- a/ayanova/src/router.js +++ b/ayanova/src/router.js @@ -206,6 +206,12 @@ export default new Router({ component: () => import(/* webpackChunkName: "ay-common" */ "./views/home-password.vue") }, + { + path: "/home-security", + name: "home-security", + component: () => + import(/* webpackChunkName: "ay-common" */ "./views/home-security.vue") + }, { path: "/home-notify-subscriptions", name: "home-notify-subscriptions", diff --git a/ayanova/src/store.js b/ayanova/src/store.js index a98b3a21..c56de477 100644 --- a/ayanova/src/store.js +++ b/ayanova/src/store.js @@ -25,6 +25,7 @@ export default new Vuex.Store({ helpUrl: "", apiToken: "-", downloadToken: "-", + tfaEnabled: undefined, userId: 0, userName: "NOT AUTHENTICATED", roles: 0, @@ -68,11 +69,13 @@ export default new Vuex.Store({ state.userName = data.userName; state.userType = data.userType; state.downloadToken = data.dlt; + state.tfaEnabled = data.tfaEnabled; }, logout(state) { //Things that are reset on logout state.apiToken = "-"; state.downloadToken = "-"; + state.tfaEnabled = undefined; state.authenticated = false; state.userId = 0; state.userName = "NOT AUTHENTICATED"; diff --git a/ayanova/src/views/home-security.vue b/ayanova/src/views/home-security.vue new file mode 100644 index 00000000..d402ef9c --- /dev/null +++ b/ayanova/src/views/home-security.vue @@ -0,0 +1,228 @@ + + + diff --git a/ayanova/src/views/home-user-settings.vue b/ayanova/src/views/home-user-settings.vue index a110b7b5..80d3a557 100644 --- a/ayanova/src/views/home-user-settings.vue +++ b/ayanova/src/views/home-user-settings.vue @@ -477,6 +477,13 @@ function generateMenu(vm) { data: "home-password", key: "app:nav" }); + + menuOptions.menuItems.push({ + title: "Two factor authentication", + icon: "$ayiKey", + data: "home-security", + key: "app:nav:SECURITY" + }); menuOptions.menuItems.push({ divider: true, inset: false }); window.$gz.eventBus.$emit("menu-change", menuOptions); }