Fix cross-domain cookie issue
This commit is contained in:
parent
ced68d9304
commit
93d5980f05
7 changed files with 31 additions and 7 deletions
|
|
@ -106,6 +106,7 @@ function handleLoginPage(req, res) {
|
|||
*/
|
||||
function handleLogout(req, res) {
|
||||
res.clearCookie("auth");
|
||||
res.clearCookie("auth", { domain: Config.get("http.root-domain") });
|
||||
// Try to find an appropriate redirect
|
||||
var ref = req.header("referrer");
|
||||
if (!ref) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ function merge(locals) {
|
|||
var _locals = {
|
||||
siteTitle: Config.get("html-template.title"),
|
||||
siteDescription: Config.get("html-template.description"),
|
||||
siteAuthor: "Calvin 'calzoneman' 'cyzon' Montgomery"
|
||||
siteAuthor: "Calvin 'calzoneman' 'cyzon' Montgomery",
|
||||
loginDomain: Config.get("https.enabled") ? Config.get("https.domain")+":"+Config.get("https.port")
|
||||
: Config.get("http.domain")+":"+Config.get("http.port")
|
||||
};
|
||||
if (typeof locals !== "object") {
|
||||
return _locals;
|
||||
|
|
|
|||
|
|
@ -64,12 +64,13 @@ function logRequest(req, status) {
|
|||
|
||||
function cookieall(res, name, val, opts) {
|
||||
res.cookie(name, val, opts);
|
||||
opts.domain = Config.get("http.domain");
|
||||
res.cookie(name, val, opts);
|
||||
if (Config.get("https.enabled")) {
|
||||
opts.domain = Config.get("https.domain");
|
||||
res.cookie(name, val, opts);
|
||||
|
||||
opts.domain = Config.get("http.root-domain");
|
||||
if (Config.get("http.domain").indexOf(opts.domain) === -1) {
|
||||
opts.domain = Config.get("http.domain");
|
||||
}
|
||||
|
||||
res.cookie(name, val, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue