delete old modals (refactored into new settings ui)

This commit is contained in:
negue
2023-02-05 19:32:40 +01:00
parent b5be137a8d
commit 64fb4c0cf9
3 changed files with 0 additions and 211 deletions
@@ -1,86 +0,0 @@
<template>
<b-modal
id="delete"
:title="$t('deleteAccount')"
:hide-footer="true"
size="md"
>
<div class="modal-body">
<br>
<strong v-if="user.auth.local.has_password">{{ $t('deleteLocalAccountText') }}</strong>
<strong
v-if="!user.auth.local.has_password"
>{{ $t('deleteSocialAccountText', {magicWord: 'DELETE'}) }}</strong>
<div class="row mt-3">
<div class="col-6">
<input
v-model="password"
class="form-control"
type="password"
>
</div>
</div>
<div class="row mt-3">
<div
id="feedback"
class="col-12 form-group"
>
<label for="feedbackTextArea">{{ $t('feedback') }}</label>
<textarea
id="feedbackTextArea"
v-model="feedback"
class="form-control"
></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button
class="btn btn-primary"
@click="close()"
>
{{ $t('neverMind') }}
</button>
<button
class="btn btn-danger"
:disabled="!password"
@click="deleteAccount()"
>
{{ $t('deleteDo') }}
</button>
</div>
</b-modal>
</template>
<script>
import axios from 'axios';
import { mapState } from '@/libs/store';
export default {
data () {
return {
password: '',
feedback: '',
};
},
computed: {
...mapState({ user: 'user.data' }),
},
methods: {
close () {
this.$root.$emit('bv::hide::modal', 'delete');
},
async deleteAccount () {
await axios.delete('/api/v4/user', {
data: {
password: this.password,
feedback: this.feedback,
},
});
localStorage.clear();
window.location.href = '/static/home';
this.$root.$emit('bv::hide::modal', 'delete');
},
},
};
</script>
@@ -1,46 +0,0 @@
<template>
<b-modal
id="reset"
:title="$t('resetAccount')"
:hide-footer="true"
size="md"
>
<p>{{ $t('resetText1') }}</p>
<p>{{ $t('resetText2') }}</p>
<div class="modal-footer">
<button
class="btn btn-primary"
@click="close()"
>
{{ $t('neverMind') }}
</button>
<button
class="btn btn-danger"
@click="reset()"
>
{{ $t('resetDo') }}
</button>
</div>
</b-modal>
</template>
<script>
import axios from 'axios';
import { mapState } from '@/libs/store';
export default {
computed: {
...mapState({ user: 'user.data' }),
},
methods: {
close () {
this.$root.$emit('bv::hide::modal', 'reset');
},
async reset () {
await axios.post('/api/v4/user/reset');
this.$router.push('/');
setTimeout(() => window.location.reload(true), 100);
},
},
};
</script>
@@ -1,7 +1,5 @@
<template>
<div class="row standard-page">
<reset-modal />
<delete-modal />
<h1 class="col-12">
{{ $t('settings') }}
</h1>
@@ -145,73 +143,6 @@
</div>
</div>
</div>
<div class="usersettings">
<h5 v-if="user.auth.local.has_password">
{{ $t('changePass') }}
</h5>
<div
v-if="user.auth.local.has_password"
class="form"
name="changePassword"
novalidate="novalidate"
>
<div class="form-group">
<input
id="changePassword"
v-model="passwordUpdates.password"
class="form-control"
type="password"
:placeholder="$t('oldPass')"
>
</div>
<div class="form-group">
<input
v-model="passwordUpdates.newPassword"
class="form-control"
type="password"
:placeholder="$t('newPass')"
>
</div>
<div class="form-group">
<input
v-model="passwordUpdates.confirmPassword"
class="form-control"
type="password"
:placeholder="$t('confirmPass')"
>
</div>
<button
class="btn btn-primary"
type="submit"
@click="changeUser('password', passwordUpdates)"
>
{{ $t('submit') }}
</button>
</div>
<hr>
</div>
<div>
<h5>{{ $t('dangerZone') }}</h5>
<div>
<button
v-b-popover.hover.auto="$t('resetAccPop')"
class="btn btn-danger mr-2 mb-2"
popover-trigger="mouseenter"
popover-placement="right"
@click="openResetModal()"
>
{{ $t('resetAccount') }}
</button>
<button
v-b-popover.hover.auto="$t('deleteAccPop')"
class="btn btn-danger mb-2"
popover-trigger="mouseenter"
@click="openDeleteModal()"
>
{{ $t('deleteAccount') }}
</button>
</div>
</div>
</div>
</div>
</div>
@@ -245,16 +176,12 @@
import hello from 'hellojs';
import axios from 'axios';
import { mapState } from '@/libs/store';
import resetModal from './resetModal';
import deleteModal from './deleteModal';
import { SUPPORTED_SOCIAL_NETWORKS } from '@/../../common/script/constants';
import notificationsMixin from '../../mixins/notifications';
import { buildAppleAuthUrl } from '../../libs/auth';
export default {
components: {
resetModal,
deleteModal,
},
mixins: [notificationsMixin],
data () {
@@ -361,12 +288,6 @@ export default {
});
}
},
openResetModal () {
this.$root.$emit('bv::show::modal', 'reset');
},
openDeleteModal () {
this.$root.$emit('bv::show::modal', 'delete');
},
async deleteSocialAuth (network) {
await axios.delete(`/api/v4/user/auth/social/${network.key}`);
this.user.auth[network.key] = {};