Password reset fix

This commit is contained in:
eugenijm 2020-01-27 02:00:49 +03:00
parent fd02cc7505
commit 67bffe2887
4 changed files with 9 additions and 7 deletions

View file

@ -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 }
})
}

View file

@ -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
}

View file

@ -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: () => {

View file

@ -277,7 +277,7 @@ export default {
return
}
this.$store.dispatch('RequirePasswordReset', { nickname })
this.$store.dispatch('RequirePasswordReset', { nicknames: [nickname] })
},
toggleActivation(user) {
user.deactivated