Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/twofactor_totp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-03-15 13:56:36 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-03-15 19:08:57 +0300
commitdfb3a94cabfe0491a9beb11cfbe4ecca5346faa2 (patch)
treee6a18bad436dc99930fecccab69597c7f9da1f6c /src
parent0375e8e51e4ed8acf13b97cc2a01e814e44c6710 (diff)
Swith to client-side QR lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'src')
-rw-r--r--src/components/PersonalTotpSettings.vue13
-rw-r--r--src/store.js4
2 files changed, 11 insertions, 6 deletions
diff --git a/src/components/PersonalTotpSettings.vue b/src/components/PersonalTotpSettings.vue
index 9f2d617..b563578 100644
--- a/src/components/PersonalTotpSettings.vue
+++ b/src/components/PersonalTotpSettings.vue
@@ -38,7 +38,7 @@
<div v-if="secret">
<p>{{ t('twofactor_totp', 'Your new TOTP secret is:' )}} {{secret}}</p>
<p> {{ t('twofactor_totp', 'For quick setup, scan this QR code with your TOTP app:') }}</p>
- <img :src="qr">
+ <QR :value="qrUrl" :options="{width: 150}"></QR>
<p> {{ t('twofactor_totp', 'After you configured your app, enter a test code below to ensure everything works correctly:') }} </p>
<input id="totp-confirmation"
type="tel"
@@ -61,17 +61,22 @@
<script>
import confirmPassword from 'nextcloud-password-confirmation'
+ import QR from '@chenfengyuan/vue-qrcode'
import state from '../state'
export default {
name: 'PersonalTotpSettings',
+ components: {
+ QR
+ },
data () {
return {
loading: false,
loadingConfirmation: false,
enabled: this.$store.state.totpState === state.STATE_ENABLED,
secret: undefined,
+ qrUrl: '',
confirmation: '',
}
},
@@ -100,9 +105,9 @@
return confirmPassword()
.then(() => this.$store.dispatch('enable'))
- .then(({secret, qr}) => {
+ .then(({secret, qrUrl}) => {
this.secret = secret
- this.qr = qr
+ 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
@@ -129,7 +134,7 @@
// Success
this.loading = false
this.enabled = true
- this.qr = undefined
+ this.qrUrl = ''
this.secret = undefined
} else {
OC.Notification.showTemporary(t('twofactor_totp', 'Could not verify your key. Please try again'));
diff --git a/src/store.js b/src/store.js
index fd73b98..dbd61ec 100644
--- a/src/store.js
+++ b/src/store.js
@@ -21,9 +21,9 @@ const saveState = (data) => {
export const actions = {
enable ({commit}) {
return saveState({state: state.STATE_CREATED})
- .then(({state, secret, qr}) => {
+ .then(({state, secret, qrUrl}) => {
commit('setState', state)
- return {qr, secret}
+ return {qrUrl, secret}
})
},