Skip to content

Commit 9cfea0e

Browse files
authored
fix(demo-mode): redirect on logout (#86098)
1 parent d87b8d0 commit 9cfea0e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

static/app/actionCreators/account.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {Client} from 'sentry/api';
33
import ConfigStore from 'sentry/stores/configStore';
44
import type {UserIdentityConfig} from 'sentry/types/auth';
55
import type {User} from 'sentry/types/user';
6+
import {isDemoModeEnabled} from 'sentry/utils/demoMode';
67
import type {ChangeAvatarUser} from 'sentry/views/settings/account/accountDetails';
78

89
export async function disconnectIdentity(
@@ -46,11 +47,15 @@ export function updateUser(user: User | ChangeAvatarUser) {
4647
ConfigStore.set('user', {...previousUser, ...user, options});
4748
}
4849

49-
export async function logout(api: Client, redirectUrl = '/auth/login/') {
50+
export async function logout(api: Client, redirectUrl?: string) {
5051
const data = await api.requestPromise('/auth/', {method: 'DELETE'});
5152

5253
// If there's a URL for SAML Single-logout, redirect back to IdP
53-
window.location.assign(data?.sloUrl || redirectUrl);
54+
window.location.assign(data?.sloUrl || getRedirectUrl(redirectUrl));
55+
}
56+
57+
function getRedirectUrl(redirectUrl = '/auth/login/') {
58+
return isDemoModeEnabled() ? 'https://sentry.io' : redirectUrl;
5459
}
5560

5661
export function removeAuthenticator(api: Client, userId: string, authId: string) {

0 commit comments

Comments
 (0)