diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-04-14 12:15:35 +0300 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2022-04-14 12:23:57 +0300 |
commit | 4d7f2387a3852a736ae5f5497806faae03fd8d93 (patch) | |
tree | 0461b6dcdd0c7b1c6113aed2e0689a68b6a6abbb /src | |
parent | 3626769cdf8e863330bb4c85d9daff8a2d647d47 (diff) |
Move to global configs
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/LoginSetup.vue | 10 | ||||
-rw-r--r-- | src/components/PersonalTotpSettings.vue | 18 | ||||
-rw-r--r-- | src/components/SetupConfirmation.vue | 16 | ||||
-rw-r--r-- | src/logger.js | 2 | ||||
-rw-r--r-- | src/main-login-setup.js | 6 | ||||
-rw-r--r-- | src/main-settings.js | 6 | ||||
-rw-r--r-- | src/services/StateService.js | 2 | ||||
-rw-r--r-- | src/state.js | 2 | ||||
-rw-r--r-- | src/store.js | 2 | ||||
-rw-r--r-- | src/tests/components/PersonalTotpSettings.spec.js | 10 | ||||
-rw-r--r-- | src/tests/setup.js | 2 | ||||
-rw-r--r-- | src/webpack.common.js | 53 | ||||
-rw-r--r-- | src/webpack.dev.js | 12 | ||||
-rw-r--r-- | src/webpack.prod.js | 7 | ||||
-rw-r--r-- | src/webpack.test.js | 30 |
15 files changed, 31 insertions, 147 deletions
diff --git a/src/components/LoginSetup.vue b/src/components/LoginSetup.vue index 2031a3f..88e62db 100644 --- a/src/components/LoginSetup.vue +++ b/src/components/LoginSetup.vue @@ -21,16 +21,14 @@ <template> <div> - <div v-if="loading" class="loading"></div> - <SetupConfirmation - v-else + <div v-if="loading" class="loading" /> + <SetupConfirmation v-else :loading="confirmationLoading" :secret="secret" :qr-url="qrUrl" :confirmation.sync="confirmation" - @confirm="confirm" - /> - <form ref="confirmForm" method="POST"></form> + @confirm="confirm" /> + <form ref="confirmForm" method="POST" /> </div> </template> diff --git a/src/components/PersonalTotpSettings.vue b/src/components/PersonalTotpSettings.vue index 9605f3c..340fc7f 100644 --- a/src/components/PersonalTotpSettings.vue +++ b/src/components/PersonalTotpSettings.vue @@ -22,31 +22,27 @@ <template> <div id="twofactor-totp-settings"> <template v-if="loading"> - <span class="icon-loading-small totp-loading"></span> + <span class="icon-loading-small totp-loading" /> <span> {{ t('twofactor_totp', 'Enable TOTP') }} </span> </template> <div v-else> - <input - id="totp-enabled" + <input id="totp-enabled" v-model="enabled" type="checkbox" class="checkbox" :disabled="loading" - @change="toggleEnabled" - /> + @change="toggleEnabled"> <label for="totp-enabled">{{ t('twofactor_totp', 'Enable TOTP') }}</label> </div> - <SetupConfirmation - v-if="secret" + <SetupConfirmation v-if="secret" :secret="secret" :qr-url="qrUrl" :loading="loadingConfirmation" :confirmation.sync="confirmation" - @confirm="enableTOTP" - /> + @confirm="enableTOTP" /> </div> </template> @@ -105,8 +101,8 @@ export default { this.qrUrl = qrUrl // If the stat could be changed, keep showing the loading // spinner until the user has finished the registration - this.loading = - this.$store.state.totpState === state.STATE_CREATED + this.loading + = this.$store.state.totpState === state.STATE_CREATED }) .catch((e) => { OC.Notification.showTemporary( diff --git a/src/components/SetupConfirmation.vue b/src/components/SetupConfirmation.vue index 0b12453..3b6ca37 100644 --- a/src/components/SetupConfirmation.vue +++ b/src/components/SetupConfirmation.vue @@ -32,7 +32,7 @@ ) }} </p> - <QR :value="qrUrl" :options="{ width: 150 }"></QR> + <QR :value="qrUrl" :options="{ width: 150 }" /> <p> {{ t( @@ -41,8 +41,7 @@ ) }} </p> - <input - id="totp-confirmation" + <input id="totp-confirmation" v-model="confirmationCode" type="tel" minlength="6" @@ -51,15 +50,12 @@ autocapitalize="off" :disabled="loading" :placeholder="t('twofactor_totp', 'Authentication code')" - @keydown="onConfirmKeyDown" - /> - <input - id="totp-confirmation-submit" + @keydown="onConfirmKeyDown"> + <input id="totp-confirmation-submit" type="button" :disabled="loading" :value="t('twofactor_totp', 'Verify')" - @click="confirm" - /> + @click="confirm"> </div> </template> @@ -112,5 +108,3 @@ export default { }, } </script> - -<style scoped></style> diff --git a/src/logger.js b/src/logger.js index 498a8fa..5debf16 100644 --- a/src/logger.js +++ b/src/logger.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> diff --git a/src/main-login-setup.js b/src/main-login-setup.js index 5489e07..6c6003e 100644 --- a/src/main-login-setup.js +++ b/src/main-login-setup.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> @@ -20,8 +20,8 @@ */ import Vue from 'vue' - import Logger from './logger' +import LoginSetup from './components/LoginSetup' Vue.mixin({ methods: { @@ -29,8 +29,6 @@ Vue.mixin({ }, }) -import LoginSetup from './components/LoginSetup' - Logger.debug('rendering login setup view') const View = Vue.extend(LoginSetup) new View().$mount('#twofactor-totp-login-setup') diff --git a/src/main-settings.js b/src/main-settings.js index afaf1d9..6832492 100644 --- a/src/main-settings.js +++ b/src/main-settings.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> @@ -24,6 +24,8 @@ import { loadState } from '@nextcloud/initial-state' import Logger from './logger' import store from './store' +import PersonalTotpSettings from './components/PersonalTotpSettings' + Vue.mixin({ methods: { t, @@ -34,8 +36,6 @@ store.replaceState({ totpState: loadState('twofactor_totp', 'state'), }) -import PersonalTotpSettings from './components/PersonalTotpSettings' - const View = Vue.extend(PersonalTotpSettings) new View({ store, diff --git a/src/services/StateService.js b/src/services/StateService.js index 5f4f3f5..946a53e 100644 --- a/src/services/StateService.js +++ b/src/services/StateService.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> diff --git a/src/state.js b/src/state.js index 4d93741..78dde36 100644 --- a/src/state.js +++ b/src/state.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> diff --git a/src/store.js b/src/store.js index 3bea29d..6d18ca5 100644 --- a/src/store.js +++ b/src/store.js @@ -25,7 +25,7 @@ export const actions = { confirm({ commit }, code) { return saveState({ state: state.STATE_ENABLED, - code: code, + code, }).then(({ state }) => commit('setState', state)) }, diff --git a/src/tests/components/PersonalTotpSettings.spec.js b/src/tests/components/PersonalTotpSettings.spec.js index e83d832..bbdeeb5 100644 --- a/src/tests/components/PersonalTotpSettings.spec.js +++ b/src/tests/components/PersonalTotpSettings.spec.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> @@ -22,15 +22,15 @@ import { shallowMount, createLocalVue } from '@vue/test-utils' import Vuex from 'vuex' +import PersonalTotpSettings from '../../components/PersonalTotpSettings' + const localVue = createLocalVue() localVue.use(Vuex) -import PersonalTotpSettings from '../../components/PersonalTotpSettings' - describe('PersonalTotpSettings', () => { - var actions - var store + let actions + let store beforeEach(() => { actions = { diff --git a/src/tests/setup.js b/src/tests/setup.js index 8823a68..b1ee2f8 100644 --- a/src/tests/setup.js +++ b/src/tests/setup.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> * * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> diff --git a/src/webpack.common.js b/src/webpack.common.js deleted file mode 100644 index d55ee36..0000000 --- a/src/webpack.common.js +++ /dev/null @@ -1,53 +0,0 @@ -const path = require('path') -const { VueLoaderPlugin } = require('vue-loader') - -module.exports = { - entry: { - 'main-settings': path.join(__dirname, 'main-settings.js'), - 'main-login-setup': path.join(__dirname, 'main-login-setup.js'), - }, - output: { - path: path.resolve(__dirname, '../js'), - publicPath: '/js/', - }, - module: { - rules: [ - { - test: /\.css$/, - use: ['vue-style-loader', 'css-loader'], - }, - { - test: /\.scss$/, - use: ['vue-style-loader', 'css-loader', 'sass-loader'], - }, - { - test: /\.vue$/, - loader: 'vue-loader', - }, - { - test: /\.js$/, - loader: 'babel-loader', - exclude: /node_modules/, - }, - { - test: /\.(png|jpg|gif)$/, - loader: 'file-loader', - options: { - name: '[name].[ext]?[hash]', - }, - }, - { - test: /\.(svg)$/i, - use: [ - { - loader: 'url-loader', - }, - ], - }, - ], - }, - plugins: [new VueLoaderPlugin()], - resolve: { - extensions: ['*', '.js', '.vue'], - }, -} diff --git a/src/webpack.dev.js b/src/webpack.dev.js deleted file mode 100644 index 42c4c9b..0000000 --- a/src/webpack.dev.js +++ /dev/null @@ -1,12 +0,0 @@ -const { merge } = require('webpack-merge') -const common = require('./webpack.common.js') - -module.exports = merge(common, { - mode: 'development', - devServer: { - historyApiFallback: true, - noInfo: true, - overlay: true, - }, - devtool: 'source-map', -}) diff --git a/src/webpack.prod.js b/src/webpack.prod.js deleted file mode 100644 index f64cdb8..0000000 --- a/src/webpack.prod.js +++ /dev/null @@ -1,7 +0,0 @@ -const { merge } = require('webpack-merge') -const common = require('./webpack.common.js') - -module.exports = merge(common, { - mode: 'production', - devtool: '#source-map', -}) diff --git a/src/webpack.test.js b/src/webpack.test.js deleted file mode 100644 index 2463f5d..0000000 --- a/src/webpack.test.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -const { merge } = require('webpack-merge') -const common = require('./webpack.common.js') -const nodeExternals = require('webpack-node-externals') - -module.exports = merge(common, { - mode: 'development', - devtool: 'inline-cheap-module-source-map', - externals: [nodeExternals()], -}) |