mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Redirect user to login when they reset their own sessions/API tokens from admin user management page (#1240)
* Redirect to login when user resets their sessions * Update Cypress test
This commit is contained in:
parent
959c1fda81
commit
917e1886d2
2 changed files with 6 additions and 2 deletions
|
|
@ -33,7 +33,7 @@ describe("Reset user sessions flow", () => {
|
|||
cy.findByText(/reset sessions/i).should("exist");
|
||||
cy.findByRole("button", { name: /confirm/i }).click();
|
||||
});
|
||||
cy.findByText(/sessions reset/i).should("exist");
|
||||
cy.findByText(/reset sessions/i).should("not.exist");
|
||||
|
||||
// user should be logged out now so log in again and go to profile to get new API token
|
||||
cy.visit("/");
|
||||
|
|
|
|||
|
|
@ -216,12 +216,16 @@ export class UserManagementPage extends Component {
|
|||
};
|
||||
|
||||
onResetSessions = () => {
|
||||
const { dispatch } = this.props;
|
||||
const { LOGIN } = paths;
|
||||
const { currentUser, dispatch } = this.props;
|
||||
const { userEditing } = this.state;
|
||||
const { toggleResetSessionsUserModal } = this;
|
||||
dispatch(userActions.deleteSessions(userEditing))
|
||||
.then(() => {
|
||||
dispatch(renderFlash("success", "Sessions reset"));
|
||||
if (currentUser.id === userEditing.id) {
|
||||
dispatch(push(LOGIN));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
dispatch(
|
||||
|
|
|
|||
Loading…
Reference in a new issue