Skip to content

Commit

Permalink
Merge pull request #1031 from jay-hodgson/set-cookie-domain
Browse files Browse the repository at this point in the history
SWC-6826: must set to sub domain to share cookie
  • Loading branch information
jay-hodgson authored Jun 26, 2024
2 parents 6260d0a + ab9f721 commit 4c47e68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/SageAccountWeb/src/components/AccountSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ export const AccountSettings = () => {
const current = new Date()
const nextYear = new Date()
nextYear.setFullYear(current.getFullYear() + 1)
const hostname = window.location.hostname.toLowerCase()
cookies.set(SynapseConstants.DATETIME_UTC_COOKIE_KEY, isUTCTime, {
path: '/',
expires: nextYear,
domain: hostname.endsWith('.synapse.org') ? 'synapse.org' : undefined,
})
}, [isUTCTime])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ export const useCookiePreferences = (): [
const current = new Date()
const nextYear = new Date()
nextYear.setFullYear(current.getFullYear() + 1)
const hostname = window.location.hostname.toLowerCase()
cookies.set(COOKIES_AGREEMENT_COOKIE_KEY, prefs, {
path: '/',
expires: nextYear,
domain: hostname.endsWith('.synapse.org') ? 'synapse.org' : undefined,
})

setCookiePreferencesAtomValue(prefs)
Expand Down

0 comments on commit 4c47e68

Please sign in to comment.