From c3ba068dd73214e92d3a451a06611dca07ade6d2 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 29 May 2020 18:49:50 +0200 Subject: [PATCH] Hide totp settings if it is disabled server side --- src/components/user/Settings.vue | 7 ++++++- src/store/modules/config.js | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/user/Settings.vue b/src/components/user/Settings.vue index acb0efcb9..777754875 100644 --- a/src/components/user/Settings.vue +++ b/src/components/user/Settings.vue @@ -75,7 +75,7 @@ -
+

Two Factor Authentication @@ -132,6 +132,8 @@ import TotpModel from '../../models/totp' import TotpService from '../../services/totp' + import {mapState} from 'vuex' + export default { name: 'Settings', data() { @@ -177,6 +179,9 @@ this.error(e, this) }) }, + computed: mapState({ + totpEnabled: state => state.config.totpEnabled + }), methods: { updatePassword() { if (this.passwordConfirm !== this.passwordUpdate.newPassword) { diff --git a/src/store/modules/config.js b/src/store/modules/config.js index 8d206fbfe..9b77c9778 100644 --- a/src/store/modules/config.js +++ b/src/store/modules/config.js @@ -13,6 +13,7 @@ export default { registrationEnabled: true, availableMigrators: [], taskAttachmentsEnabled: true, + totpEnabled: true, }), mutations: { [CONFIG](state, config) { @@ -24,6 +25,7 @@ export default { state.registrationEnabled = config.registration_enabled state.availableMigrators = config.available_migrators state.taskAttachmentsEnabled = config.task_attachments_enabled + state.totpEnabled = config.totp_enabled }, }, actions: {