Merge branch 'fix-password-reset' into 'develop'

Fix for forced password reset

Closes #70

See merge request pleroma/admin-fe!84
This commit is contained in:
Angelina Filippova 2020-01-28 18:28:10 +00:00
commit ece7485a4c
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