diff --git a/src/components/Challenge.vue b/src/components/Challenge.vue new file mode 100644 index 0000000..2e4b212 --- /dev/null +++ b/src/components/Challenge.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/main-challenge.js b/src/main-challenge.js new file mode 100644 index 0000000..8365451 --- /dev/null +++ b/src/main-challenge.js @@ -0,0 +1,41 @@ +/* + * @copyright 2018 Christoph Wurst + * + * @author 2018 Christoph Wurst + * + * @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 . + */ + +import store from './store' +import Vue from 'vue' + +import Nextcloud from './mixins/Nextcloud' + +Vue.mixin(Nextcloud) + +const initialStateElement = document.getElementById('twofactor-u2f-req') +const req = JSON.parse(initialStateElement.value) + +import Challenge from './components/Challenge' + +const View = Vue.extend(Challenge) +new View({ + propsData: { + req, + httpWarning: document.location.protocol !== 'https:', + }, + store, +}).$mount('#twofactor-u2f-challenge') diff --git a/src/webpack.common.js b/src/webpack.common.js index 789da78..4940550 100644 --- a/src/webpack.common.js +++ b/src/webpack.common.js @@ -2,11 +2,13 @@ const path = require('path'); const { VueLoaderPlugin } = require('vue-loader'); module.exports = { - entry: path.join(__dirname, 'main-settings.js'), + entry: { + challenge: path.join(__dirname, 'main-challenge.js'), + settings: path.join(__dirname, 'main-settings.js') + }, output: { path: path.resolve(__dirname, '../js'), publicPath: '/js/', - filename: 'settings.js' }, module: { rules: [ diff --git a/templates/challenge.php b/templates/challenge.php index 1e67cd0..1f10542 100644 --- a/templates/challenge.php +++ b/templates/challenge.php @@ -1,30 +1,10 @@ - - -
- -
- -

-t('Plug in your U2F device and press the device button to authorize.')) ?> -

- -

- - t('In Firefox, you need to install the "U2F Support Add-on" to use U2F. This is not needed in Chrome.')) ?> -

- -

+ + +