feat: disable password settings for users authenticated with third party auth (#921)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: vikunja/frontend#921
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:38:13 +00:00
parent 1873c74776
commit ecb5be4b17
3 changed files with 17 additions and 4 deletions

View File

@ -8,12 +8,12 @@
{{ $t('user.settings.general.title') }}
</router-link>
</li>
<li>
<li v-if="isLocalUser">
<router-link :to="{name: 'user.settings.password-update'}">
{{ $t('user.settings.newPasswordTitle') }}
</router-link>
</li>
<li>
<li v-if="isLocalUser">
<router-link :to="{name: 'user.settings.email-update'}">
{{ $t('user.settings.updateEmailTitle') }}
</router-link>
@ -70,6 +70,9 @@ export default {
migratorsEnabled() {
return this.$store.getters['config/migratorsEnabled']
},
isLocalUser() {
return this.$store.state.auth.info?.isLocalUser
},
},
}
</script>

View File

@ -1,5 +1,5 @@
<template>
<card :title="$t('user.settings.updateEmailTitle')">
<card v-if="isLocalUser" :title="$t('user.settings.updateEmailTitle')">
<form @submit.prevent="updateEmail">
<div class="field">
<label class="label" for="newEmail">{{ $t('user.settings.updateEmailNew') }}</label>
@ -51,6 +51,11 @@ export default {
mounted() {
this.setTitle(`${this.$t('user.settings.updateEmailTitle')} - ${this.$t('user.settings.title')}`)
},
computed: {
isLocalUser() {
return this.$store.state.auth.info?.isLocalUser
},
},
methods: {
async updateEmail() {
await this.emailUpdateService.update(this.emailUpdate)

View File

@ -1,5 +1,5 @@
<template>
<card :title="$t('user.settings.newPasswordTitle')" :loading="passwordUpdateService.loading">
<card v-if="isLocalUser" :title="$t('user.settings.newPasswordTitle')" :loading="passwordUpdateService.loading">
<form @submit.prevent="updatePassword">
<div class="field">
<label class="label" for="newPassword">{{ $t('user.settings.newPassword') }}</label>
@ -67,6 +67,11 @@ export default {
mounted() {
this.setTitle(`${this.$t('user.settings.newPasswordTitle')} - ${this.$t('user.settings.title')}`)
},
computed: {
isLocalUser() {
return this.$store.state.auth.info?.isLocalUser
},
},
methods: {
async updatePassword() {
if (this.passwordConfirm !== this.passwordUpdate.newPassword) {