File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 55} from '@linode/utilities' ;
66import * as Sentry from '@sentry/react' ;
77
8- import { clearUserInput , storage } from 'src/utilities/storage' ;
8+ import { clearStorage , clearUserInput , storage } from 'src/utilities/storage' ;
99
1010import { getAppRoot , getClientId , getLoginURL } from './constants' ;
1111import { generateCodeChallenge , generateCodeVerifier } from './pkce' ;
@@ -45,6 +45,7 @@ function clearNonceAndCodeVerifierFromLocalStorage() {
4545function clearAllAuthDataFromLocalStorage ( ) {
4646 clearNonceAndCodeVerifierFromLocalStorage ( ) ;
4747 clearAuthDataFromLocalStorage ( ) ;
48+ clearStorage ( 'switch_account/company_name' ) ;
4849}
4950
5051export function clearStorageAndRedirectToLogout ( ) {
@@ -105,6 +106,7 @@ export async function logout() {
105106
106107 clearUserInput ( ) ;
107108 clearAuthDataFromLocalStorage ( ) ;
109+ clearStorage ( 'switch_account/company_name' ) ;
108110
109111 if ( token ) {
110112 const tokenWithoutPrefix = token . split ( ' ' ) [ 1 ] ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
22
33import { PARENT_USER_SESSION_EXPIRED } from 'src/features/Account/constants' ;
4- import { setStorage } from 'src/utilities/storage' ;
4+ import { clearStorage , setStorage } from 'src/utilities/storage' ;
55
66import { useParentChildAuthentication } from './useParentChildAuthentication' ;
77
@@ -38,7 +38,8 @@ export const useSwitchToParentAccount = ({
3838
3939 // Flag to prevent multiple clicks on the switch account button.
4040 setSubmitting ( true ) ;
41-
41+ // Clean up the company name in storage to prevent it from being used in the parent account after switching back from a child account.
42+ clearStorage ( 'switch_account/company_name' ) ;
4243 try {
4344 // Revoke proxy or delegate token before switching to parent account.
4445 await revokeToken ( ) . catch ( ( ) => {
Original file line number Diff line number Diff line change @@ -121,8 +121,9 @@ export const UserMenuPopover = (props: UserMenuPopoverProps) => {
121121 }
122122 : undefined ;
123123
124+ const switchAccountCompanyName = getStorage ( 'switch_account/company_name' ) ;
124125 const companyNameOrEmail = getCompanyNameOrEmail ( {
125- company : account ?. company ,
126+ company : account ?. company ? account ?. company : switchAccountCompanyName ,
126127 profile,
127128 } ) ;
128129 const { data : parentProfile } = useProfile ( { headers : proxyHeaders } ) ;
You can’t perform that action at this time.
0 commit comments