From aa9ea40961bba32b3220b2f9bf1c306ca6b3ba7a Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 25 Oct 2019 00:47:04 +0200 Subject: [PATCH] Filter users when password reset is required --- src/store/modules/users.js | 6 +++++- src/views/users/components/MultipleUsersMenu.vue | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 5d7fb257..0290b888 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -210,7 +210,11 @@ const users = { dispatch('SuccessMessage') }, async RequirePasswordReset({ dispatch, getters }, user) { - await requirePasswordReset(user.nickname, getters.authHost, getters.token) + try { + await requirePasswordReset(user.nickname, getters.authHost, getters.token) + } catch (_e) { + return + } dispatch('SuccessMessage') }, async SearchUsers({ commit, dispatch, state, getters }, { query, page }) { diff --git a/src/views/users/components/MultipleUsersMenu.vue b/src/views/users/components/MultipleUsersMenu.vue index 1122f237..f3be52cf 100644 --- a/src/views/users/components/MultipleUsersMenu.vue +++ b/src/views/users/components/MultipleUsersMenu.vue @@ -206,7 +206,9 @@ export default { applyAction(filtered, removeTagFn) }, requirePasswordReset: () => { - this.selectedUsers.map(user => this.$store.dispatch('RequirePasswordReset', user)) + const filtered = this.selectedUsers.filter(user => user.local) + filtered.map(user => this.$store.dispatch('RequirePasswordReset', user)) + this.$emit('apply-action') } } },