fix(user): allow openid users to request their deletion
Resolves https://community.vikunja.io/t/delete-user-not-possible-when-using-oidc/1689/4
This commit is contained in:
parent
f0b340a9c7
commit
ae001c6ca7
|
@ -176,6 +176,7 @@
|
||||||
"title": "Delete your Vikunja Account",
|
"title": "Delete your Vikunja Account",
|
||||||
"text1": "The deletion of your account is permanent and cannot be undone. We will delete all your projects, tasks and everything associated with it.",
|
"text1": "The deletion of your account is permanent and cannot be undone. We will delete all your projects, tasks and everything associated with it.",
|
||||||
"text2": "To proceed, please enter your password. You will receive an email with further instructions.",
|
"text2": "To proceed, please enter your password. You will receive an email with further instructions.",
|
||||||
|
"text3": "To proceed, please press the button below. You will receive an email with further instructions.",
|
||||||
"confirm": "Delete my account",
|
"confirm": "Delete my account",
|
||||||
"requestSuccess": "The request was successful. You'll receive an email with further instructions.",
|
"requestSuccess": "The request was successful. You'll receive an email with further instructions.",
|
||||||
"passwordRequired": "Please enter your password.",
|
"passwordRequired": "Please enter your password.",
|
||||||
|
@ -183,6 +184,7 @@
|
||||||
"scheduled": "We will delete your Vikunja account at {date} ({dateSince}).",
|
"scheduled": "We will delete your Vikunja account at {date} ({dateSince}).",
|
||||||
"scheduledCancel": "To cancel the deletion of your account, click here.",
|
"scheduledCancel": "To cancel the deletion of your account, click here.",
|
||||||
"scheduledCancelText": "To cancel the deletion of your account, please enter your password below:",
|
"scheduledCancelText": "To cancel the deletion of your account, please enter your password below:",
|
||||||
|
"scheduledCancelButton": "To cancel the deletion of your account, please press the button below:",
|
||||||
"scheduledCancelConfirm": "Cancel the deletion of my account",
|
"scheduledCancelConfirm": "Cancel the deletion of my account",
|
||||||
"scheduledCancelSuccess": "We will not delete your account."
|
"scheduledCancelSuccess": "We will not delete your account."
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,29 +10,34 @@
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<template v-if="isLocalUser">
|
||||||
{{ $t('user.deletion.scheduledCancelText') }}
|
<p>
|
||||||
</p>
|
{{ $t('user.deletion.scheduledCancelText') }}
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="currentPasswordAccountDelete">
|
|
||||||
{{ $t('user.settings.currentPassword') }}
|
|
||||||
</label>
|
|
||||||
<div class="control">
|
|
||||||
<input
|
|
||||||
class="input"
|
|
||||||
:class="{'is-danger': errPasswordRequired}"
|
|
||||||
id="currentPasswordAccountDelete"
|
|
||||||
:placeholder="$t('user.settings.currentPasswordPlaceholder')"
|
|
||||||
type="password"
|
|
||||||
v-model="password"
|
|
||||||
@keyup="() => errPasswordRequired = password === ''"
|
|
||||||
ref="passwordInput"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<p class="help is-danger" v-if="errPasswordRequired">
|
|
||||||
{{ $t('user.deletion.passwordRequired') }}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
<div class="field">
|
||||||
|
<label class="label" for="currentPasswordAccountDelete">
|
||||||
|
{{ $t('user.settings.currentPassword') }}
|
||||||
|
</label>
|
||||||
|
<div class="control">
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
:class="{'is-danger': errPasswordRequired}"
|
||||||
|
id="currentPasswordAccountDelete"
|
||||||
|
:placeholder="$t('user.settings.currentPasswordPlaceholder')"
|
||||||
|
type="password"
|
||||||
|
v-model="password"
|
||||||
|
@keyup="() => errPasswordRequired = password === ''"
|
||||||
|
ref="passwordInput"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p class="help is-danger" v-if="errPasswordRequired">
|
||||||
|
{{ $t('user.deletion.passwordRequired') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<p v-else>
|
||||||
|
{{ $t('user.deletion.scheduledCancelButton') }}
|
||||||
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<x-button
|
<x-button
|
||||||
|
@ -43,10 +48,10 @@
|
||||||
</x-button>
|
</x-button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<form @submit.prevent="deleteAccount()">
|
<p>
|
||||||
<p>
|
{{ $t('user.deletion.text1') }}
|
||||||
{{ $t('user.deletion.text1') }}
|
</p>
|
||||||
</p>
|
<form @submit.prevent="deleteAccount()" v-if="isLocalUser">
|
||||||
<p>
|
<p>
|
||||||
{{ $t('user.deletion.text2') }}
|
{{ $t('user.deletion.text2') }}
|
||||||
</p>
|
</p>
|
||||||
|
@ -71,6 +76,9 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<p v-else>
|
||||||
|
{{ $t('user.deletion.text3') }}
|
||||||
|
</p>
|
||||||
|
|
||||||
<x-button
|
<x-button
|
||||||
:loading="accountDeleteService.loading"
|
:loading="accountDeleteService.loading"
|
||||||
|
@ -83,7 +91,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default { name: 'user-settings-deletion' }
|
export default {name: 'user-settings-deletion'}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -111,9 +119,12 @@ const configStore = useConfigStore()
|
||||||
const userDeletionEnabled = computed(() => configStore.userDeletionEnabled)
|
const userDeletionEnabled = computed(() => configStore.userDeletionEnabled)
|
||||||
const deletionScheduledAt = computed(() => parseDateOrNull(authStore.info?.deletionScheduledAt))
|
const deletionScheduledAt = computed(() => parseDateOrNull(authStore.info?.deletionScheduledAt))
|
||||||
|
|
||||||
|
const isLocalUser = computed(() => authStore.info?.isLocalUser)
|
||||||
|
|
||||||
const passwordInput = ref()
|
const passwordInput = ref()
|
||||||
|
|
||||||
async function deleteAccount() {
|
async function deleteAccount() {
|
||||||
if (password.value === '') {
|
if (isLocalUser.value && password.value === '') {
|
||||||
errPasswordRequired.value = true
|
errPasswordRequired.value = true
|
||||||
passwordInput.value.focus()
|
passwordInput.value.focus()
|
||||||
return
|
return
|
||||||
|
@ -125,7 +136,7 @@ async function deleteAccount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cancelDeletion() {
|
async function cancelDeletion() {
|
||||||
if (password.value === '') {
|
if (isLocalUser.value && password.value === '') {
|
||||||
errPasswordRequired.value = true
|
errPasswordRequired.value = true
|
||||||
passwordInput.value.focus()
|
passwordInput.value.focus()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue