diff options
author | Vitor Mattos <vitor@php.rio> | 2022-05-06 18:56:20 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-05-06 18:56:20 +0300 |
commit | 7afe209b812920d38f0877879680fcdc6fabe849 (patch) | |
tree | a456a390d7ff49d856a6861777a014cd50d3e16a /js | |
parent | bc6fc726db7276eecd444b81c42055b9de7bf949 (diff) |
Bump js packages
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'js')
-rw-r--r-- | js/components/GatewaySettings.vue | 145 | ||||
-rw-r--r-- | js/components/L10n.vue | 14 | ||||
-rw-r--r-- | js/components/SignalInstructions.vue | 13 | ||||
-rw-r--r-- | js/components/TelegramInstructions.vue | 19 | ||||
-rw-r--r-- | js/init.js | 19 | ||||
-rw-r--r-- | js/service/registration.js | 74 | ||||
-rw-r--r-- | js/views/SMSSettings.vue | 13 | ||||
-rw-r--r-- | js/views/SignalSettings.vue | 38 | ||||
-rw-r--r-- | js/views/TelegramSettings.vue | 38 | ||||
-rw-r--r-- | js/webpack.base.config.js | 46 | ||||
-rw-r--r-- | js/webpack.dev.config.js | 8 | ||||
-rw-r--r-- | js/webpack.prod.config.js | 16 |
12 files changed, 0 insertions, 443 deletions
diff --git a/js/components/GatewaySettings.vue b/js/components/GatewaySettings.vue deleted file mode 100644 index 868ee8f..0000000 --- a/js/components/GatewaySettings.vue +++ /dev/null @@ -1,145 +0,0 @@ -<template> - <div> - <div v-if="!isAvailable"> - <L10n text="The {displayName} gateway is not configured." - :options="{displayName: displayName}"/> - </div> - <div v-else-if="loading"> - <span class="icon-loading-small"></span> - </div> - <div v-else> - <p v-if="state === 0"> - <slot name="instructions"/> - <L10n text="You are not using {displayName} for two-factor authentication at the moment." - :options="{displayName: displayName}"/> - <button @click="enable"> - <L10n text="Enable"></L10n> - </button> - </p> - <p v-if="state === 1"> - <slot name="instructions"/> - <strong v-if="verificationError === true"> - <L10n text="Could not verify your code. Please try again."></L10n> - </strong> - <L10n text="Enter your identification (e.g. phone number to start the verification):"></L10n> - <input v-model="identifier"> - <button @click="verify"> - <L10n text="Verify"></L10n> - </button> - </p> - <p v-if="state === 2"> - <L10n text="A confirmation code has been sent to {phone} via SMS. Please insert the code here:" - :options="{phone: phoneNumber}"></L10n> - <input v-model="confirmationCode"> - <button @click="confirm"> - <L10n text="Confirm"></L10n> - </button> - </p> - <p v-if="state === 3"> - <L10n text="Your account was successfully configured to receive messages via {displayName}." - :options="{displayName: displayName}"/> - <button @click="disable"> - <l10n text="Disable"></l10n> - </button> - </p> - </div> - </div> -</template> - -<script> - import L10n from "components/L10n.vue"; - import { - getState, - startVerification, - tryVerification, - disable - } from "service/registration"; - - export default { - name: "GatewaySettings", - props: [ - 'gatewayName', - 'displayName', - ], - data () { - return { - loading: true, - state: 0, - isAvailable: true, - phoneNumber: '', - confirmationCode: '', - identifier: '', - verificationError: false - }; - }, - mounted: function () { - getState(this.gatewayName) - .then(res => { - console.debug('loaded state for gateway ' + this.gatewayName, res); - this.isAvailable = res.isAvailable; - this.state = res.state; - this.phoneNumber = res.phoneNumber; - }) - .catch(console.error.bind(this)) - .then(() => this.loading = false); - }, - methods: { - enable: function () { - this.state = 1; - this.verificationError = false; - this.loading = false; - }, - verify: function () { - this.loading = true; - this.verificationError = false; - startVerification(this.gatewayName, this.identifier) - .then(res => { - this.state = 2; - this.phoneNumber = res.phoneNumber; - this.loading = false; - }) - .catch(e => { - console.error(e); - this.state = 1; - this.verificationError = true; - this.loading = false; - }); - }, - confirm: function () { - this.loading = true; - - tryVerification(this.gatewayName, this.confirmationCode) - .then(res => { - this.state = 3; - this.loading = false; - }) - .catch(res => { - this.state = 1; - this.verificationError = true; - this.loading = false; - }); - }, - - disable: function () { - this.loading = true; - - disable(this.gatewayName) - .then(res => { - this.state = res.state; - this.phoneNumber = res.phoneNumber; - this.loading = false; - }) - .catch(console.error.bind(this)); - } - }, - components: { - L10n - } - } -</script> - -<style> - .icon-loading-small { - padding-left: 15px; - } -</style> diff --git a/js/components/L10n.vue b/js/components/L10n.vue deleted file mode 100644 index 03e32e0..0000000 --- a/js/components/L10n.vue +++ /dev/null @@ -1,14 +0,0 @@ -<template> - <span>{{ translated }}</span> -</template> - -<script> -export default { - computed: { - translated: function() { - return t("twofactor_gateway", this.text, this.options || {}); - } - }, - props: ["text", "options"] -}; -</script> diff --git a/js/components/SignalInstructions.vue b/js/components/SignalInstructions.vue deleted file mode 100644 index a6a3489..0000000 --- a/js/components/SignalInstructions.vue +++ /dev/null @@ -1,13 +0,0 @@ -<template> - <div> - <p> - The gateway can send authentication to your Signal mobile and deskop app. - </p> - </div> -</template> - -<script> - export default { - name: "SignalInstructions" - } -</script> diff --git a/js/components/TelegramInstructions.vue b/js/components/TelegramInstructions.vue deleted file mode 100644 index 961de79..0000000 --- a/js/components/TelegramInstructions.vue +++ /dev/null @@ -1,19 +0,0 @@ -<template> - <div> - <p> - In order to receive authentication codes via Telegram, you first - have to start a new chat with the bot set up by your admin.<br> - Secondly, you have to obtain your Telegram ID via the <a - href="https://telegram.me/getmyid_bot" - target="_blank" - rel="noreferrer noopener">ID Bot</a>. - Enter this ID to receive your verification code below. - </p> - </div> -</template> - -<script> - export default { - name: "TelegramInstructions" - } -</script> diff --git a/js/init.js b/js/init.js deleted file mode 100644 index c9364d7..0000000 --- a/js/init.js +++ /dev/null @@ -1,19 +0,0 @@ -import Vue from "vue" - -import SignalSettings from "views/SignalSettings.vue" -import SMSSettings from "views/SMSSettings.vue" -import TelegramSettings from "views/TelegramSettings.vue" - -Vue.config.productionTip = false - -new Vue({ - render: h => h(SignalSettings) -}).$mount('#twofactor-gateway-signal') - -new Vue({ - render: h => h(SMSSettings) -}).$mount('#twofactor-gateway-sms') - -new Vue({ - render: h => h(TelegramSettings) -}).$mount('#twofactor-gateway-telegram') diff --git a/js/service/registration.js b/js/service/registration.js deleted file mode 100644 index d65c6a7..0000000 --- a/js/service/registration.js +++ /dev/null @@ -1,74 +0,0 @@ -import {nc_fetch_json} from 'nextcloud_fetch'; - -export function getState (gateway) { - let url = OC.generateUrl('/apps/twofactor_gateway/settings/{gateway}/verification', { - gateway: gateway - }) - - return nc_fetch_json(url).then(function (resp) { - if (resp.ok) { - return resp.json().then(json => { - json.isAvailable = true - return json - }) - } - if (resp.status === 503) { - console.info(gateway + ' gateway is not available') - return { - isAvailable: false - } - } - throw resp - }) -} - -export function startVerification (gateway, identifier) { - let url = OC.generateUrl('/apps/twofactor_gateway/settings/{gateway}/verification/start', { - gateway: gateway - }) - - return nc_fetch_json(url, { - method: 'POST', - body: JSON.stringify({ - identifier: identifier - }) - }).then(function (resp) { - if (resp.ok) { - return resp.json(); - } - throw resp; - }) -} - -export function tryVerification (gateway, code) { - let url = OC.generateUrl('/apps/twofactor_gateway/settings/{gateway}/verification/finish', { - gateway: gateway - }) - - return nc_fetch_json(url, { - method: 'POST', - body: JSON.stringify({ - verificationCode: code - }) - }).then(function (resp) { - if (resp.ok) { - return resp.json(); - } - throw resp; - }) -} - -export function disable (gateway) { - let url = OC.generateUrl('/apps/twofactor_gateway/settings/{gateway}/verification', { - gateway: gateway - }) - - return nc_fetch_json(url, { - method: 'DELETE' - }).then(function (resp) { - if (resp.ok) { - return resp.json(); - } - throw resp; - }) -} diff --git a/js/views/SMSSettings.vue b/js/views/SMSSettings.vue deleted file mode 100644 index b386e35..0000000 --- a/js/views/SMSSettings.vue +++ /dev/null @@ -1,13 +0,0 @@ -<template> - <GatewaySettings gateway-name="sms" display-name="SMS" /> -</template> - -<script> - import GatewaySettings from "../components/GatewaySettings.vue"; - - export default { - components: { - GatewaySettings, - } - }; -</script> diff --git a/js/views/SignalSettings.vue b/js/views/SignalSettings.vue deleted file mode 100644 index 9f1577e..0000000 --- a/js/views/SignalSettings.vue +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - - @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - - - - @author 2019 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/>. - --> - -<template> - <GatewaySettings gateway-name="signal" display-name="Signal"> - <SignalInstructions slot="instructions"/> - </GatewaySettings> -</template> - -<script> - import GatewaySettings from "../components/GatewaySettings.vue"; - import SignalInstructions from "../components/SignalInstructions.vue"; - - export default { - components: { - SignalInstructions, - GatewaySettings, - } - }; -</script> diff --git a/js/views/TelegramSettings.vue b/js/views/TelegramSettings.vue deleted file mode 100644 index 86f572b..0000000 --- a/js/views/TelegramSettings.vue +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - - @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - - - - @author 2019 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/>. - --> - -<template> - <GatewaySettings gateway-name="telegram" display-name="Telegram"> - <TelegramInstructions slot="instructions"/> - </GatewaySettings> -</template> - -<script> - import GatewaySettings from "../components/GatewaySettings.vue"; - import TelegramInstructions from "../components/TelegramInstructions.vue"; - - export default { - components: { - TelegramInstructions, - GatewaySettings, - } - }; -</script> diff --git a/js/webpack.base.config.js b/js/webpack.base.config.js deleted file mode 100644 index 7c8ee3d..0000000 --- a/js/webpack.base.config.js +++ /dev/null @@ -1,46 +0,0 @@ -const path = require('path'); -const {VueLoaderPlugin} = require('vue-loader') - -module.exports = { - entry: './js/init.js', - node: { - fs: 'empty' - }, - output: { - filename: 'build.js', - path: path.resolve(__dirname, 'build') - }, - resolve: { - modules: [path.resolve(__dirname), 'node_modules'], - }, - module: { - rules: [ - { - test: /\.vue$/, - loader: 'vue-loader', - options: { - loaders: {} - } - }, - { - test: /\.css$/, - use: [ - { - loader: 'vue-style-loader' - }, - { - loader: 'css-loader', - options: { - modules: { - localIdentName: '[local]_[hash:base64:8]' - } - } - } - ] - } - ] - }, - plugins: [ - new VueLoaderPlugin() - ] -}; diff --git a/js/webpack.dev.config.js b/js/webpack.dev.config.js deleted file mode 100644 index fd4a085..0000000 --- a/js/webpack.dev.config.js +++ /dev/null @@ -1,8 +0,0 @@ -const { merge } = require('webpack-merge'); - -const baseConfig = require('./webpack.base.config.js'); - -module.exports = merge(baseConfig, { - devtool: 'inline-source-map', - mode: 'development' -}); diff --git a/js/webpack.prod.config.js b/js/webpack.prod.config.js deleted file mode 100644 index 734c1f2..0000000 --- a/js/webpack.prod.config.js +++ /dev/null @@ -1,16 +0,0 @@ -const { merge } = require('webpack-merge'); -const webpack = require('webpack'); - -const baseConfig = require('./webpack.base.config.js'); - -module.exports = merge(baseConfig, { - plugins: [ - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('production') - } - }), - new webpack.optimize.AggressiveMergingPlugin()// Merge chunks - ], - mode: 'production' -}); |