Skip to content

Commit 17f81d2

Browse files
committed
feat: implement reset password functionality for admins, still need to port reset password view
1 parent dec117f commit 17f81d2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/views/Profile.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142

143143
<div class="actions-destructive actions-panel" v-if="canDeactivate() || canReactivate() || canDelete()">
144144
<div class="profile-action" v-if="canReset()">
145-
<a href="#" @click.prevent="showReset = true">Reset Password</a>
145+
<a href="#" @click.prevent="resetPassword()">Reset Password</a>
146146
</div>
147147
<div class="profile-action" v-if="canDeactivate()">
148148
<a href="#" @click.prevent="showDeactivate = true">Deactivate Account</a>
@@ -310,6 +310,10 @@ export default {
310310
.then(() => $alertStore.success(`${v.user.ignore_messages ? 'Ignoring' : 'Unignoring' } messages from ${v.user.username}`))
311311
}
312312
313+
const resetPassword = () => usersApi.adminRecover({ user_id: v.user.id })
314+
.then(() => $alertStore.success('Password Reset Email Sent'))
315+
.catch(() => $alertStore.error('Error resetting password'))
316+
313317
/* Internal Data */
314318
const $router = useRouter()
315319
const $auth = inject(AuthStore)
@@ -336,7 +340,7 @@ export default {
336340
showDelete: false,
337341
showManageBans: false
338342
})
339-
return { ...toRefs(v), refreshUser, banExpiration, toggleIgnorePosts, toggleIgnoreMessages, toggleIgnoreMentions, redirectHome, canUpdate, canUpdateUsername, canMessage, userAge, canUpdatePrivate, pageOwner, canPageUserNotes, canBanUser, canBoardBanUser, canReactivate, canReset, canDeactivate, canDelete, humanDate }
343+
return { ...toRefs(v), refreshUser, banExpiration, toggleIgnorePosts, toggleIgnoreMessages, toggleIgnoreMentions, redirectHome, canUpdate, canUpdateUsername, canMessage, userAge, canUpdatePrivate, pageOwner, canPageUserNotes, canBanUser, canBoardBanUser, canReactivate, canReset, canDeactivate, canDelete, resetPassword, humanDate }
340344
}
341345
}
342346
</script>

0 commit comments

Comments
 (0)