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

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/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') }} {{ $t('user.settings.general.title') }}
</router-link> </router-link>
</li> </li>
<li> <li v-if="isLocalUser">
<router-link :to="{name: 'user.settings.password-update'}"> <router-link :to="{name: 'user.settings.password-update'}">
{{ $t('user.settings.newPasswordTitle') }} {{ $t('user.settings.newPasswordTitle') }}
</router-link> </router-link>
</li> </li>
<li> <li v-if="isLocalUser">
<router-link :to="{name: 'user.settings.email-update'}"> <router-link :to="{name: 'user.settings.email-update'}">
{{ $t('user.settings.updateEmailTitle') }} {{ $t('user.settings.updateEmailTitle') }}
</router-link> </router-link>
@ -70,6 +70,9 @@ export default {
migratorsEnabled() { migratorsEnabled() {
return this.$store.getters['config/migratorsEnabled'] return this.$store.getters['config/migratorsEnabled']
}, },
isLocalUser() {
return this.$store.state.auth.info?.isLocalUser
},
}, },
} }
</script> </script>

View file

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

View file

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