Skip to content

Commit 2c2cdb1

Browse files
committed
Fix cookie path
1 parent c6ab7ee commit 2c2cdb1

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

experimental/test-login.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
console.log('Starting test-login.js');
22

3+
function htmlEncode(text) {
4+
const tempDiv = document.createElement('div');
5+
tempDiv.innerText = text;
6+
return tempDiv.innerHTML;
7+
}
8+
39
const rootDiv = document.getElementById('root');
410

511
if (!rootDiv) {
@@ -17,20 +23,19 @@ document.cookie
1723
cookieMap[pair[0]] = decodeURIComponent(pair[1]);
1824
});
1925

20-
function htmlEncode(text) {
21-
const tempDiv = document.createElement('div');
22-
tempDiv.innerText = text;
23-
return tempDiv.innerHTML;
24-
}
25-
2626
var loggedInUser = (cookieMap['rscommunity-logged-in-user'] || '').trim();
2727

2828
var serviceUrl = '';
2929
if (document.location.hostname.toUpperCase() !== 'LOCALHOST') {
3030
serviceUrl = 'https://service.rushstack.io';
3131
}
3232

33-
document.cookie = 'rscommunity-login-return-path=' + encodeURIComponent(document.location.pathname) + '; SameSite=Strict;'
33+
document.cookie = [
34+
'rscommunity-login-return-path=' + encodeURIComponent(document.location.pathname),
35+
'SameSite=Strict',
36+
'Domain=' + document.location.hostname,
37+
'Path=/'
38+
].join(';');
3439

3540
if (loggedInUser) {
3641
// prettier-ignore

0 commit comments

Comments
 (0)