diff --git a/src/api/users.js b/src/api/users.js index 3755ee7c..f3398c68 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -89,12 +89,13 @@ export async function getPasswordResetToken(nickname, authHost, token) { }) } -export async function requirePasswordReset(nickname, authHost, token) { +export async function requirePasswordReset(nicknames, authHost, token) { return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/users/${nickname}/force_password_reset`, + url: `/api/pleroma/admin/users/force_password_reset`, method: 'patch', - headers: authHeaders(token) + headers: authHeaders(token), + data: { nicknames } }) } diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 1f10b6c4..dccbb1ca 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -240,9 +240,9 @@ const users = { } dispatch('SuccessMessage') }, - async RequirePasswordReset({ dispatch, getters }, user) { + async RequirePasswordReset({ dispatch, getters }, { nicknames }) { try { - await requirePasswordReset(user.nickname, getters.authHost, getters.token) + await requirePasswordReset(nicknames, getters.authHost, getters.token) } catch (_e) { return } diff --git a/src/views/users/components/MultipleUsersMenu.vue b/src/views/users/components/MultipleUsersMenu.vue index 1fdc029b..6eb18c1c 100644 --- a/src/views/users/components/MultipleUsersMenu.vue +++ b/src/views/users/components/MultipleUsersMenu.vue @@ -216,7 +216,8 @@ export default { }, requirePasswordReset: () => { const filtered = this.selectedUsers.filter(user => user.local) - filtered.map(user => this.$store.dispatch('RequirePasswordReset', user)) + const nicknames = filtered.map(u => u.nickname) + this.$store.dispatch('RequirePasswordReset', { nicknames }) this.$emit('apply-action') }, confirmAccounts: () => { diff --git a/src/views/users/index.vue b/src/views/users/index.vue index 4cb24199..fee15291 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -277,7 +277,7 @@ export default { return } - this.$store.dispatch('RequirePasswordReset', { nickname }) + this.$store.dispatch('RequirePasswordReset', { nicknames: [nickname] }) }, toggleActivation(user) { user.deactivated