mirror of
https://github.com/docmost/docmost.git
synced 2025-11-15 19:41: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 workspaceId = user?.workspace?.id;
|
||||
let hosts = [];
|
||||
let workspaceIds = [];
|
||||
try {
|
||||
hosts = req.cookies.workspaces ? JSON.parse(req.cookies.hosts) : [];
|
||||
workspaceIds = req.cookies.joinedWorkspaces
|
||||
? JSON.parse(req.cookies.joinedWorkspaces)
|
||||
: [];
|
||||
} catch (err) {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
if (!hosts.includes(workspaceId)) {
|
||||
hosts.push(workspaceId);
|
||||
if (!workspaceIds.includes(workspaceId)) {
|
||||
workspaceIds.push(workspaceId);
|
||||
}
|
||||
|
||||
// todo: revisit
|
||||
res.setCookie('joinedWorkspaces', JSON.stringify(hosts), {
|
||||
res.setCookie('joinedWorkspaces', JSON.stringify(workspaceIds), {
|
||||
httpOnly: false,
|
||||
domain: '.' + this.environmentService.getSubdomainHost(),
|
||||
path: '/',
|
||||
|
||||
Reference in New Issue
Block a user