|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
import {withRouter, WithRouterProps} from 'react-router';
|
|
import {withRouter, WithRouterProps} from 'react-router';
|
|
import styled from '@emotion/styled';
|
|
import styled from '@emotion/styled';
|
|
|
|
|
|
|
|
+import {logout} from 'sentry/actionCreators/account';
|
|
import {ModalRenderProps} from 'sentry/actionCreators/modal';
|
|
import {ModalRenderProps} from 'sentry/actionCreators/modal';
|
|
import {Client} from 'sentry/api';
|
|
import {Client} from 'sentry/api';
|
|
import Alert from 'sentry/components/alert';
|
|
import Alert from 'sentry/components/alert';
|
|
@@ -133,6 +134,16 @@ class SudoModal extends React.Component<Props, State> {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ handleLogout = async () => {
|
|
|
|
+ const {api} = this.props;
|
|
|
|
+ try {
|
|
|
|
+ await logout(api);
|
|
|
|
+ } catch {
|
|
|
|
+ // ignore errors
|
|
|
|
+ }
|
|
|
|
+ window.location.assign('/auth/login/');
|
|
|
|
+ };
|
|
|
|
+
|
|
async getAuthenticators() {
|
|
async getAuthenticators() {
|
|
const {api} = this.props;
|
|
const {api} = this.props;
|
|
|
|
|
|
@@ -150,6 +161,11 @@ class SudoModal extends React.Component<Props, State> {
|
|
const user = ConfigStore.get('user');
|
|
const user = ConfigStore.get('user');
|
|
const isSelfHosted = ConfigStore.get('isSelfHosted');
|
|
const isSelfHosted = ConfigStore.get('isSelfHosted');
|
|
|
|
|
|
|
|
+ if (errorType === ErrorCodes.invalidSSOSession) {
|
|
|
|
+ this.handleLogout();
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (
|
|
if (
|
|
(!user.hasPasswordAuth && authenticators.length === 0) ||
|
|
(!user.hasPasswordAuth && authenticators.length === 0) ||
|
|
(isSuperuser && !isSelfHosted)
|
|
(isSuperuser && !isSelfHosted)
|