mirror of
https://github.com/docmost/docmost.git
synced 2025-11-16 02:01:11 +10:00
fix cookie name
This commit is contained in:
@ -46,19 +46,20 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
|
|||||||
const res = ctx.switchToHttp().getResponse();
|
const res = ctx.switchToHttp().getResponse();
|
||||||
|
|
||||||
const workspaceId = user?.workspace?.id;
|
const workspaceId = user?.workspace?.id;
|
||||||
let hosts = [];
|
let workspaceIds = [];
|
||||||
try {
|
try {
|
||||||
hosts = req.cookies.workspaces ? JSON.parse(req.cookies.hosts) : [];
|
workspaceIds = req.cookies.joinedWorkspaces
|
||||||
|
? JSON.parse(req.cookies.joinedWorkspaces)
|
||||||
|
: [];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hosts.includes(workspaceId)) {
|
if (!workspaceIds.includes(workspaceId)) {
|
||||||
hosts.push(workspaceId);
|
workspaceIds.push(workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: revisit
|
res.setCookie('joinedWorkspaces', JSON.stringify(workspaceIds), {
|
||||||
res.setCookie('joinedWorkspaces', JSON.stringify(hosts), {
|
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
domain: '.' + this.environmentService.getSubdomainHost(),
|
domain: '.' + this.environmentService.getSubdomainHost(),
|
||||||
path: '/',
|
path: '/',
|
||||||
|
|||||||
Reference in New Issue
Block a user