Browse Source
Merge pull request #2791 from Budibase/rory/fixes
Honour cookie domain on empty values
gh-pages
Rory Powell
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
12 additions and
14 deletions
-
packages/auth/src/utils.js
|
|
|
@ -67,24 +67,22 @@ exports.getCookie = (ctx, name) => { |
|
|
|
* @param {string|object} value The value of cookie which will be set. |
|
|
|
*/ |
|
|
|
exports.setCookie = (ctx, value, name = "builder") => { |
|
|
|
if (!value) { |
|
|
|
ctx.cookies.set(name) |
|
|
|
} else { |
|
|
|
if (value) { |
|
|
|
value = jwt.sign(value, options.secretOrKey) |
|
|
|
} |
|
|
|
|
|
|
|
const config = { |
|
|
|
maxAge: Number.MAX_SAFE_INTEGER, |
|
|
|
path: "/", |
|
|
|
httpOnly: false, |
|
|
|
overwrite: true, |
|
|
|
} |
|
|
|
|
|
|
|
if (environment.COOKIE_DOMAIN) { |
|
|
|
config.domain = environment.COOKIE_DOMAIN |
|
|
|
} |
|
|
|
const config = { |
|
|
|
maxAge: Number.MAX_SAFE_INTEGER, |
|
|
|
path: "/", |
|
|
|
httpOnly: false, |
|
|
|
overwrite: true, |
|
|
|
} |
|
|
|
|
|
|
|
ctx.cookies.set(name, value, config) |
|
|
|
if (environment.COOKIE_DOMAIN) { |
|
|
|
config.domain = environment.COOKIE_DOMAIN |
|
|
|
} |
|
|
|
|
|
|
|
ctx.cookies.set(name, value, config) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|