Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
let isHybridAppSetupFinished = false;
let hasSwitchedAccountInHybridMode = false;

Onyx.connect({

Check warning on line 82 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
session = value ?? {};
Expand All @@ -104,25 +104,25 @@
});

let stashedSession: Session = {};
Onyx.connect({

Check warning on line 107 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.STASHED_SESSION,
callback: (value) => (stashedSession = value ?? {}),
});

let credentials: Credentials = {};
Onyx.connect({

Check warning on line 113 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CREDENTIALS,
callback: (value) => (credentials = value ?? {}),
});

let stashedCredentials: Credentials = {};
Onyx.connect({

Check warning on line 119 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.STASHED_CREDENTIALS,
callback: (value) => (stashedCredentials = value ?? {}),
});

let activePolicyID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 125 in src/libs/actions/Session/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
callback: (newActivePolicyID) => {
activePolicyID = newActivePolicyID;
Expand Down Expand Up @@ -263,7 +263,10 @@
.catch((error) => {
Log.hmmm('SAML sign out failed', {error});
})
.then(() => {
.then((result) => {
if (result && result.type !== 'success') {
return Promise.reject(Error('Logout cancelled'));
}
Comment thread
jnowakow marked this conversation as resolved.
// We always want to sign out the user from the app
// eslint-disable-next-line rulesdir/no-api-side-effects-method
return API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.LOG_OUT, params, {});
Expand Down Expand Up @@ -333,11 +336,6 @@
return;
}

// When signing out from the HybridApp, we need to sign out from the oldDot app as well
if (CONFIG.IS_HYBRID_APP && shouldSignOutFromOldDot) {
HybridAppModule.signOutFromOldDot();
}

const isSupportal = isSupportAuthToken();
const shouldRestoreStashedSession = isSupportal || shouldForceUseStashedSession;

Expand Down Expand Up @@ -401,6 +399,10 @@
// Wait for signOut (if called), then redirect and update Onyx.
return signOutPromise
.then((response) => {
// When signing out from the HybridApp, we need to sign out from the oldDot app as well
if (CONFIG.IS_HYBRID_APP && shouldSignOutFromOldDot) {
HybridAppModule.signOutFromOldDot();
}
if (isSupportal) {
// Send event to Fraud Protection backend, otherwise it might consider the user as being suspicious
FraudProtection.sendEvent(FRAUD_PROTECTION_EVENT.STOP_SUPPORT_SESSION);
Expand Down
Loading