aboutsummaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/twofactor_backupcodes/src')
-rw-r--r--apps/twofactor_backupcodes/src/service/BackupCodesService.js23
-rw-r--r--apps/twofactor_backupcodes/src/service/PrintService.js22
-rw-r--r--apps/twofactor_backupcodes/src/settings.js27
-rw-r--r--apps/twofactor_backupcodes/src/store.js24
-rw-r--r--apps/twofactor_backupcodes/src/views/PersonalSettings.vue78
5 files changed, 63 insertions, 111 deletions
diff --git a/apps/twofactor_backupcodes/src/service/BackupCodesService.js b/apps/twofactor_backupcodes/src/service/BackupCodesService.js
index 56a22fa0fd3..0abf365ccdb 100644
--- a/apps/twofactor_backupcodes/src/service/BackupCodesService.js
+++ b/apps/twofactor_backupcodes/src/service/BackupCodesService.js
@@ -1,25 +1,6 @@
/**
- * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0-or-later
- *
- * 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/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
import Axios from '@nextcloud/axios'
diff --git a/apps/twofactor_backupcodes/src/service/PrintService.js b/apps/twofactor_backupcodes/src/service/PrintService.js
index 138eef5136a..4575628744a 100644
--- a/apps/twofactor_backupcodes/src/service/PrintService.js
+++ b/apps/twofactor_backupcodes/src/service/PrintService.js
@@ -1,24 +1,6 @@
/**
- * @copyright Copyright (c) 2016 John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @license AGPL-3.0-or-later
- *
- * 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/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
/**
diff --git a/apps/twofactor_backupcodes/src/settings.js b/apps/twofactor_backupcodes/src/settings.js
index 30f80c2fbeb..53aa7e365af 100644
--- a/apps/twofactor_backupcodes/src/settings.js
+++ b/apps/twofactor_backupcodes/src/settings.js
@@ -1,32 +1,13 @@
/**
- * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0-or-later
- *
- * 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/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { loadState } from '@nextcloud/initial-state'
import Vue from 'vue'
-import PersonalSettings from './views/PersonalSettings'
-import store from './store'
+import PersonalSettings from './views/PersonalSettings.vue'
+import store from './store.js'
Vue.prototype.t = t
diff --git a/apps/twofactor_backupcodes/src/store.js b/apps/twofactor_backupcodes/src/store.js
index bac11bf82f2..1d5cdcafc6d 100644
--- a/apps/twofactor_backupcodes/src/store.js
+++ b/apps/twofactor_backupcodes/src/store.js
@@ -1,29 +1,11 @@
/**
- * @copyright 2019 Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0-or-later
- *
- * 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/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
import Vue from 'vue'
import Vuex, { Store } from 'vuex'
-import { generateCodes } from './service/BackupCodesService'
+import { generateCodes } from './service/BackupCodesService.js'
Vue.use(Vuex)
diff --git a/apps/twofactor_backupcodes/src/views/PersonalSettings.vue b/apps/twofactor_backupcodes/src/views/PersonalSettings.vue
index d72b5392557..3e17613bb47 100644
--- a/apps/twofactor_backupcodes/src/views/PersonalSettings.vue
+++ b/apps/twofactor_backupcodes/src/views/PersonalSettings.vue
@@ -1,38 +1,49 @@
+<!--
+ - SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
- <div>
- <button v-if="!enabled"
+ <div class="backupcodes-settings">
+ <NcButton v-if="!enabled"
id="generate-backup-codes"
:disabled="generatingCodes"
@click="generateBackupCodes">
+ <template #icon>
+ <NcLoadingIcon v-if="generatingCodes" />
+ </template>
{{ t('twofactor_backupcodes', 'Generate backup codes') }}
- <span :class="{'icon-loading-small': generatingCodes}" />
- </button>
+ </NcButton>
<template v-else>
- <p>
+ <p class="backupcodes-settings__codes">
<template v-if="!haveCodes">
{{ t('twofactor_backupcodes', 'Backup codes have been generated. {used} of {total} codes have been used.', {used, total}) }}
</template>
<template v-else>
- {{ t('twofactor_backupcodes', 'These are your backup codes. Please save and/or print them as you will not be able to read the codes again later') }}
+ {{ t('twofactor_backupcodes', 'These are your backup codes. Please save and/or print them as you will not be able to read the codes again later.') }}
<ul>
- <li v-for="code in codes" :key="code" class="backup-code">
+ <li v-for="code in codes"
+ :key="code"
+ class="backupcodes-settings__codes__code">
{{ code }}
</li>
</ul>
- <a :href="downloadUrl"
- class="button primary"
- :download="downloadFilename">{{ t('twofactor_backupcodes', 'Save backup codes') }}</a>
- <button class="button"
- @click="printCodes">
- {{ t('twofactor_backupcodes', 'Print backup codes') }}
- </button>
</template>
</p>
- <p>
- <button id="generate-backup-codes"
+ <p class="backupcodes-settings__actions">
+ <template v-if="haveCodes">
+ <NcButton :href="downloadUrl"
+ :download="downloadFilename"
+ type="primary">
+ {{ t('twofactor_backupcodes', 'Save backup codes') }}
+ </NcButton>
+ <NcButton @click="printCodes">
+ {{ t('twofactor_backupcodes', 'Print backup codes') }}
+ </NcButton>
+ </template>
+ <NcButton id="generate-backup-codes"
@click="generateBackupCodes">
{{ t('twofactor_backupcodes', 'Regenerate backup codes') }}
- </button>
+ </NcButton>
</p>
<p>
<em>
@@ -45,11 +56,18 @@
<script>
import { confirmPassword } from '@nextcloud/password-confirmation'
+import { print } from '../service/PrintService.js'
+import NcButton from '@nextcloud/vue/components/NcButton'
+import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
+
import '@nextcloud/password-confirmation/dist/style.css'
-import { print } from '../service/PrintService'
export default {
name: 'PersonalSettings',
+ components: {
+ NcButton,
+ NcLoadingIcon,
+ },
data() {
return {
generatingCodes: false,
@@ -93,7 +111,7 @@ export default {
// Hide old codes
this.generatingCodes = true
- this.$store.dispatch('generate').then(data => {
+ this.$store.dispatch('generate').then(() => {
this.generatingCodes = false
}).catch(err => {
OC.Notification.showTemporary(t('twofactor_backupcodes', 'An error occurred while generating your backup codes'))
@@ -119,13 +137,21 @@ export default {
}
</script>
-<style scoped>
- .backup-code {
- font-family: monospace;
- letter-spacing: 0.02em;
- font-size: 1.2em;
+<style lang="scss" scoped>
+.backupcodes-settings {
+ &__codes {
+ &__code {
+ font-family: monospace;
+ letter-spacing: 0.02em;
+ font-size: 1.2em;
+ }
}
- .button {
- display: inline-block;
+
+ &__actions {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: var(--default-grid-baseline);
}
+}
</style>