feat: allow openid users to export their data without a password (#918)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: vikunja/frontend#918
Reviewed-by: dpschen <dpschen@noreply.kolaente.de>
Co-authored-by: konrad <k@knt.li>
Co-committed-by: konrad <k@knt.li>
This commit is contained in:
konrad 2021-10-31 13:16:28 +00:00
parent a515b0c3a4
commit 5b406b0172
2 changed files with 58 additions and 44 deletions

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="content"> <div class="content">
<h1>{{ $t('user.export.downloadTitle') }}</h1> <h1>{{ $t('user.export.downloadTitle') }}</h1>
<template v-if="isLocalUser">
<p>{{ $t('user.export.descriptionPasswordRequired') }}</p> <p>{{ $t('user.export.descriptionPasswordRequired') }}</p>
<div class="field"> <div class="field">
<label class="label" for="currentPasswordDataExport"> <label class="label" for="currentPasswordDataExport">
@ -22,6 +23,7 @@
{{ $t('user.deletion.passwordRequired') }} {{ $t('user.deletion.passwordRequired') }}
</p> </p>
</div> </div>
</template>
<x-button <x-button
v-focus v-focus
@ -48,9 +50,14 @@ export default {
created() { created() {
this.dataExportService = new DataExportService() this.dataExportService = new DataExportService()
}, },
computed: {
isLocalUser() {
return this.$store.state.auth.info?.isLocalUser
},
},
methods: { methods: {
download() { download() {
if (this.password === '') { if (this.password === '' && this.isLocalUser) {
this.errPasswordRequired = true this.errPasswordRequired = true
this.$refs.passwordInput.focus() this.$refs.passwordInput.focus()
return return

View File

@ -3,6 +3,7 @@
<p> <p>
{{ $t('user.export.description') }} {{ $t('user.export.description') }}
</p> </p>
<template v-if="isLocalUser">
<p> <p>
{{ $t('user.export.descriptionPasswordRequired') }} {{ $t('user.export.descriptionPasswordRequired') }}
</p> </p>
@ -26,6 +27,7 @@
{{ $t('user.deletion.passwordRequired') }} {{ $t('user.deletion.passwordRequired') }}
</p> </p>
</div> </div>
</template>
<x-button <x-button
:loading="dataExportService.loading" :loading="dataExportService.loading"
@ -48,12 +50,17 @@ export default {
errPasswordRequired: false, errPasswordRequired: false,
} }
}, },
computed: {
isLocalUser() {
return this.$store.state.auth.info?.isLocalUser
},
},
mounted() { mounted() {
this.setTitle(`${this.$t('user.export.title')} - ${this.$t('user.settings.title')}`) this.setTitle(`${this.$t('user.export.title')} - ${this.$t('user.settings.title')}`)
}, },
methods: { methods: {
async requestDataExport() { async requestDataExport() {
if (this.password === '') { if (this.password === '' && this.isLocalUser) {
this.errPasswordRequired = true this.errPasswordRequired = true
this.$refs.passwordInput.focus() this.$refs.passwordInput.focus()
return return