Page MenuHomePhorge

D1954.1775250271.diff
No OneTemporary

Authored By
Unknown
Size
9 KB
Referenced Files
None
Subscribers
None

D1954.1775250271.diff

diff --git a/src/resources/vue/User/Info.vue b/src/resources/vue/User/Info.vue
--- a/src/resources/vue/User/Info.vue
+++ b/src/resources/vue/User/Info.vue
@@ -4,7 +4,14 @@
<div class="card" id="user-info">
<div class="card-body">
- <div class="card-title" v-if="user_id !== 'new'">User account</div>
+ <div class="card-title" v-if="user_id !== 'new'">User account
+ <button
+ class="btn btn-outline-danger button-delete float-right"
+ v-on:click="showDeleteConfirmation()" tag="button"
+ >
+ <svg-icon icon="trash-alt"></svg-icon> Delete user
+ </button>
+ </div>
<div class="card-title" v-if="user_id === 'new'">New user account</div>
<div class="card-text">
<form @submit.prevent="submit">
@@ -155,6 +162,29 @@
</div>
</div>
</div>
+ <div id="delete-warning" class="modal" tabindex="-1" role="dialog">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title"></h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <p>Do you really want to delete this user permanently?
+ This will delete all account data and withdraw the permission to access the email account.
+ Please note that this action cannot be undone.</p>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-secondary modal-cancel" data-dismiss="modal">Cancel</button>
+ <button type="button" class="btn btn-danger modal-action" @click="deleteUser()">
+ <svg-icon icon="trash-alt"></svg-icon> Delete
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
</template>
@@ -367,6 +397,29 @@
},
statusUpdate(user) {
this.user = Object.assign({}, this.user, user)
+ },
+ deleteUser() {
+ // Delete the user from the confirm dialog
+ axios.delete('/api/v4/users/' + this.user_id)
+ .then(response => {
+ if (response.data.status == 'success') {
+ this.$toast.success(response.data.message)
+ this.$router.push({ name: 'users' })
+ }
+ })
+ },
+ showDeleteConfirmation() {
+ // Deleting self, redirect to /profile/delete page
+ if (this.user_id == this.$store.state.authInfo.id) {
+ this.$router.push({ name: 'profile-delete' })
+ } else {
+ // Display the warning
+ let dialog = $('#delete-warning').modal('hide')
+ dialog.find('.modal-title').text('Delete ' + this.user.email)
+ dialog.on('shown.bs.modal', () => {
+ dialog.find('button.modal-cancel').focus()
+ }).modal()
+ }
}
}
}
diff --git a/src/resources/vue/User/List.vue b/src/resources/vue/User/List.vue
--- a/src/resources/vue/User/List.vue
+++ b/src/resources/vue/User/List.vue
@@ -13,7 +13,6 @@
<thead class="thead-light">
<tr>
<th scope="col">Primary Email</th>
- <th scope="col"></th>
</tr>
</thead>
<tbody>
@@ -21,16 +20,7 @@
<td>
<svg-icon icon="user" :class="$root.userStatusClass(user)" :title="$root.userStatusText(user)"></svg-icon>
<router-link :to="{ path: 'user/' + user.id }">{{ user.email }}</router-link>
- </td>
- <td class="buttons">
- <button v-if="$root.isController(user.wallet_id)"
- title="Delete"
- class="btn btn-link text-danger button-delete p-0"
- @click="deleteUser(user.id)"
- >
- <svg-icon icon="trash-alt"></svg-icon><span class="sr-only">Delete</span>
- </button>
- </td>
+ </td>
</tr>
</tbody>
<tfoot class="table-fake-body">
@@ -42,30 +32,6 @@
</div>
</div>
</div>
-
- <div id="delete-warning" class="modal" tabindex="-1" role="dialog">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title"></h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">&times;</span>
- </button>
- </div>
- <div class="modal-body">
- <p>Do you really want to delete this user permanently?
- This will delete all account data and withdraw the permission to access the email account.
- Please note that this action cannot be undone.</p>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary modal-cancel" data-dismiss="modal">Cancel</button>
- <button type="button" class="btn btn-danger modal-action" @click="deleteUser()">
- <svg-icon icon="trash-alt"></svg-icon> Delete
- </button>
- </div>
- </div>
- </div>
- </div>
</div>
</template>
@@ -86,46 +52,6 @@
this.users = response.data
})
.catch(this.$root.errorHandler)
- },
- methods: {
- deleteUser(id) {
- let dialog = $('#delete-warning').modal('hide')
-
- // Delete the user from the confirm dialog
- if (!id && this.current_user) {
- id = this.current_user.id
- axios.delete('/api/v4/users/' + id)
- .then(response => {
- if (response.data.status == 'success') {
- this.$toast.success(response.data.message)
- $('#user' + id).remove()
- }
- })
-
- return
- }
-
- // Deleting self, redirect to /profile/delete page
- if (id == this.$store.state.authInfo.id) {
- this.$router.push({ name: 'profile-delete' })
- return
- }
-
- // Display the warning
- if (this.current_user = this.getUser(id)) {
- dialog.find('.modal-title').text('Delete ' + this.current_user.email)
- dialog.on('shown.bs.modal', () => {
- dialog.find('button.modal-cancel').focus()
- }).modal()
- }
- },
- getUser(id) {
- for (let i = 0; i < this.users.length; i++) {
- if (this.users[i].id == id) {
- return this.users[i]
- }
- }
- }
}
}
</script>
diff --git a/src/resources/vue/User/Profile.vue b/src/resources/vue/User/Profile.vue
--- a/src/resources/vue/User/Profile.vue
+++ b/src/resources/vue/User/Profile.vue
@@ -2,7 +2,16 @@
<div class="container">
<div class="card" id="user-profile">
<div class="card-body">
- <div class="card-title">Your profile</div>
+ <div class="card-title">
+ Your profile
+ <router-link
+ v-if="$root.isController(wallet_id)"
+ class="btn btn-outline-danger button-delete float-right"
+ to="/profile/delete" tag="button"
+ >
+ <svg-icon icon="trash-alt"></svg-icon> Delete account
+ </router-link>
+ </div>
<div class="card-text">
<form @submit.prevent="submit">
<div class="form-group row plaintext">
@@ -69,11 +78,6 @@
</div>
</div>
<button class="btn btn-primary button-submit" type="submit"><svg-icon icon="check"></svg-icon> Submit</button>
- <router-link
- v-if="$root.isController(wallet_id)"
- class="btn btn-danger button-delete"
- to="/profile/delete" tag="button"
- ><svg-icon icon="trash-alt"></svg-icon> Delete account</router-link>
</form>
</div>
</div>

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 9:04 PM (16 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826561
Default Alt Text
D1954.1775250271.diff (9 KB)

Event Timeline