Merge pull request #2791 from Budibase/rory/fixes
Honour cookie domain on empty values
This commit is contained in:
commit
0183a55216
1 changed files with 14 additions and 16 deletions
|
@ -67,10 +67,9 @@ exports.getCookie = (ctx, name) => {
|
||||||
* @param {string|object} value The value of cookie which will be set.
|
* @param {string|object} value The value of cookie which will be set.
|
||||||
*/
|
*/
|
||||||
exports.setCookie = (ctx, value, name = "builder") => {
|
exports.setCookie = (ctx, value, name = "builder") => {
|
||||||
if (!value) {
|
if (value) {
|
||||||
ctx.cookies.set(name)
|
|
||||||
} else {
|
|
||||||
value = jwt.sign(value, options.secretOrKey)
|
value = jwt.sign(value, options.secretOrKey)
|
||||||
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
maxAge: Number.MAX_SAFE_INTEGER,
|
maxAge: Number.MAX_SAFE_INTEGER,
|
||||||
|
@ -85,7 +84,6 @@ exports.setCookie = (ctx, value, name = "builder") => {
|
||||||
|
|
||||||
ctx.cookies.set(name, value, config)
|
ctx.cookies.set(name, value, config)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function, simply calls setCookie with an empty string for value
|
* Utility function, simply calls setCookie with an empty string for value
|
||||||
|
|
Loading…
Reference in a new issue