Skip to content

Commit c6ab7ee

Browse files
committed
Replace query parameter with cookie
1 parent 2c632d0 commit c6ab7ee

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

experimental/test-login.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,21 @@ var serviceUrl = '';
2929
if (document.location.hostname.toUpperCase() !== 'LOCALHOST') {
3030
serviceUrl = 'https://service.rushstack.io';
3131
}
32-
var returnUrlQuery = 'returnUrl=' + encodeURIComponent(document.location.pathname);
32+
33+
document.cookie = 'rscommunity-login-return-path=' + encodeURIComponent(document.location.pathname) + '; SameSite=Strict;'
3334

3435
if (loggedInUser) {
3536
// prettier-ignore
3637
rootDiv.innerHTML = 'You are logged in as <b>' + htmlEncode(loggedInUser) + '</b>.'
3738
+ '<p>'
38-
+ '<a href="' + serviceUrl + '/logout?' + returnUrlQuery + '">'
39+
+ '<a href="' + serviceUrl + '/logout">'
3940
+ 'LOG OUT'
4041
+ '</a>';
4142
} else {
4243
// prettier-ignore
4344
rootDiv.innerHTML = 'You are not logged in'
4445
+ '<p>'
45-
+ '<a href="' + serviceUrl + '/login?' + returnUrlQuery + '">'
46+
+ '<a href="' + serviceUrl + '/login-github">'
4647
+ 'LOG IN'
4748
+ '</a>';
4849
}

0 commit comments

Comments
 (0)