diff --git a/frontend/pages/admin/UserManagementPage/UserManagementPage.jsx b/frontend/pages/admin/UserManagementPage/UserManagementPage.jsx index c932e7ed08..850d44e892 100644 --- a/frontend/pages/admin/UserManagementPage/UserManagementPage.jsx +++ b/frontend/pages/admin/UserManagementPage/UserManagementPage.jsx @@ -267,15 +267,14 @@ export class UserManagementPage extends Component { }; onResetSessions = () => { - const { LOGIN } = paths; const { currentUser, dispatch } = this.props; const { userEditing } = this.state; const { toggleResetSessionsUserModal } = this; - dispatch(userActions.deleteSessions(userEditing)) + const isResettingCurrentUser = currentUser.id === userEditing.id; + + dispatch(userActions.deleteSessions(userEditing, isResettingCurrentUser)) .then(() => { - if (currentUser.id === userEditing.id) { - dispatch(push(LOGIN)); - } else { + if (!isResettingCurrentUser) { dispatch(renderFlash("success", "Sessions reset")); } }) diff --git a/frontend/redux/nodes/entities/users/actions.js b/frontend/redux/nodes/entities/users/actions.js index 32d6ace30a..0d3c5a1250 100644 --- a/frontend/redux/nodes/entities/users/actions.js +++ b/frontend/redux/nodes/entities/users/actions.js @@ -116,14 +116,17 @@ export const createUserWithoutInvitation = (formData) => { }; }; -export const deleteSessions = (user) => { +export const deleteSessions = (user, isResettingCurrentUser = false) => { const { successAction, destroyFailure, destroySuccess } = actions; return (dispatch) => { return Fleet.users .deleteSessions(user) .then((userResponse) => { - dispatch(logoutSuccess); + if (isResettingCurrentUser) { + dispatch(logoutSuccess); + } + return dispatch(successAction(userResponse, destroySuccess)); }) .catch((response) => {