Skip to content

Commit

Permalink
Merge pull request #1335 from jay-hodgson/PORTALS-3299c
Browse files Browse the repository at this point in the history
PORTALS-3299: prompt=login should not call clearSession, clearSession…
  • Loading branch information
jay-hodgson authored Oct 30, 2024
2 parents 372c8b7 + 386eaea commit 1954a62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 3 additions & 2 deletions apps/synapse-oauth-signin/src/AppInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ function AppInitializer(
}, [prompt])

const isFramed = useFramebuster()
const forceRelogin = prompt === 'login'
if (prompt === 'login') {
maxAge = 0
}
return (
<ApplicationSessionManager
maxAge={maxAge}
onNoAccessTokenFound={onNoAccessTokenFound}
forceRelogin={forceRelogin}
appId={clientId}
>
{!isFramed && props.children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export type ApplicationSessionManagerProps = React.PropsWithChildren<{
/* Called when the session is reset, i.e. the user has signed out.*/
onResetSessionComplete?: () => void
onNoAccessTokenFound?: () => void
/* If defined, the session will be cleared and the user will have to re-authenticate (if logged in) */
forceRelogin?: boolean
/*
* Callback invoked after the user has successfully signed in through SSO when the purpose of signing in is to disable 2FA on the account.
* The twoFactorAuthSSOError and twoFaResetToken are passed in the callback and can be used to complete the 2FA reset process.
Expand Down Expand Up @@ -53,7 +51,6 @@ export function ApplicationSessionManager(
onResetSessionComplete,
maxAge,
onNoAccessTokenFound,
forceRelogin,
onTwoFactorAuthResetThroughSSO,
appId,
} = props
Expand Down Expand Up @@ -142,11 +139,7 @@ export function ApplicationSessionManager(

/** Call refreshSession on mount */
useEffect(() => {
if (forceRelogin) {
clearSession()
} else {
refreshSession()
}
refreshSession()
// PORTALS-3249: Set up an interval to call refreshSession every 60 seconds (60000 milliseconds)
const intervalId = setInterval(() => {
refreshSession()
Expand Down

0 comments on commit 1954a62

Please sign in to comment.