delete account row

This commit is contained in:
negue
2022-11-22 23:36:37 +01:00
parent 4bf740c531
commit c7e40e9446
5 changed files with 120 additions and 4 deletions
@@ -19,6 +19,7 @@
<display-name-setting />
<password-setting />
<reset-account />
<delete-account />
<tr>
<td colspan="3"></td>
</tr>
@@ -63,6 +64,7 @@ import { sharedInlineSettingStore } from '@/pages/settings/inlineSettings/inline
export default {
components: {
DeleteAccount,
ResetAccount,
PasswordSetting,
DisplayNameSetting,
@@ -24,7 +24,7 @@
v-model="currentPassword"
class="form-control"
:placeholder="$t(customLabel ?? 'password')"
type="text"
type="password"
@keyup="$emit('passwordValue', currentPassword)"
>
</div>
@@ -0,0 +1,113 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
>
<td class="settings-label">
{{ $t("deleteAccount") }}
</td>
<td class="settings-value">
</td>
<td class="settings-button">
<a
class="edit-link"
@click.prevent="openModal()"
>
{{ $t('learnMore') }}
</a>
</td>
</tr>
<tr
v-if="modalVisible"
class="expanded"
>
<td colspan="3">
<div
v-once
class="dialog-title danger"
>
{{ $t("deleteAccount") }}
</div>
<div
v-once
class="dialog-disclaimer"
v-html="$t('deleteLocalAccountText')"
>
</div>
<current-password-input
:show-forget-password="true"
@passwordValue="passwordValue = $event"
/>
<div
v-once
v-html="$t('feedback')"
>
</div>
<div
class="input-area"
>
<textarea
id="feedbackTextArea"
v-model="feedback"
:placeholder="$t('feedbackPlaceholder')"
class="form-control"
></textarea>
</div>
<div class="input-area">
<save-cancel-buttons
primary-button-color="btn-danger"
primary-button-label="deleteAccount"
@saveClicked="deleteAccount()"
@cancelClicked="closeModal()"
/>
</div>
</td>
</tr>
</fragment>
</template>
<style lang="scss" scoped>
@import '~@/assets/scss/colors.scss';
</style>
<script>
import axios from 'axios';
import { mapState } from '@/libs/store';
import { InlineSettingMixin } from './inlineSettingMixin';
import SaveCancelButtons from '@/pages/settings/inlineSettings/_saveCancelButtons';
import CurrentPasswordInput from '@/pages/settings/inlineSettings/_currentPasswordInput';
export default {
components: { CurrentPasswordInput, SaveCancelButtons },
mixins: [InlineSettingMixin],
data () {
return {
passwordValue: '',
feedback: '',
};
},
computed: {
...mapState({
user: 'user.data',
}),
},
methods: {
async deleteAccount () {
await axios.delete('/api/v4/user', {
data: {
password: this.passwordValue,
feedback: this.feedback,
},
});
localStorage.clear();
window.location.href = '/static/home';
},
},
};
</script>
@@ -59,7 +59,7 @@
</div>
<div class="input-area">
Todo Password Check for Reset
Todo Password Check for Reset (Missing in the API)
<current-password-input
:show-forget-password="true"
@passwordValue="passwordValue = $event"
+3 -2
View File
@@ -31,7 +31,8 @@
"resetAccPop": "Start over, removing all levels, gold, gear, history, and tasks.",
"deleteAccount": "Delete Account",
"deleteAccPop": "Cancel and remove your Habitica account.",
"feedback": "If you'd like to give us feedback, please enter it below - we'd love to know what you liked or didn't like about Habitica! Don't speak English well? No problem! Use the language you prefer.",
"feedback": "If you'd like to give us feedback, please enter it below - we'd love to hear your feedback! It will be anonymous unless you choose to enter your contact details. Don't speak English well? No problem! Use the language you prefer.",
"feedbackPlaceholder": "Add your feedback",
"dataExport": "Data Export",
"saveData": "Here are a few options for saving your data.",
"habitHistory": "Habit History",
@@ -68,7 +69,7 @@
"resetDetail4": "You will be able to buy back Equipment, including all limited edition or subscriber Mystery items that you already own.",
"resetDetail5": "Another option is using an <b>Orb of Rebirth</b>, which will reset everything else while preserving your Tasks and Equipment.",
"resetText2": "You will lose all your levels, Gold, and Experience points. All your tasks (except those from challenges) will be deleted permanently and you will lose all of their historical data. You will lose all your equipment except Subscriber Mystery Items and free commemorative items. You will be able to buy the deleted items back, including all limited edition equipment (you will need to be in the correct class to re-buy class-specific gear). You will keep your current class, achievements and your pets and mounts. You might prefer to use an Orb of Rebirth instead, which is a much safer option and which will preserve your tasks and equipment.",
"deleteLocalAccountText": "Are you sure? This will delete your account forever, and it can never be restored! You will need to register a new account to use Habitica again. Banked or spent Gems will not be refunded. If you're absolutely certain, type your password into the text box below.",
"deleteLocalAccountText": "<b>Are you sure?</b> This will delete your account forever, and it can never be restored! You will need to register a new account to use Habitica again. Banked or spent Gems will not be refunded. If you're absolutely certain, type your password into the text box below.",
"deleteSocialAccountText": "Are you sure? This will delete your account forever, and it can never be restored! You will need to register a new account to use Habitica again. Banked or spent Gems will not be refunded. If you're absolutely certain, type \"<%= magicWord %>\" into the text box below.",
"API": "API",
"APIv3": "API v3",