document.cookie = "cookie-agreed-"+Drupal.settings.eu_cookie_compliance.popup_language + "="+value+";expires=" + date.toUTCString() + ";path=/";  

If Drupal is in a subfolder of the webroot, and another Drupal site with this module is in another subfolder, surely this cookie will affect both?

CommentFileSizeAuthor
#4 eu_cookie_compliance-1594614.patch958 bytesrsvelko

Comments

joachim’s picture

Here's how IMCE does it:

sites/all/modules/contrib/imce/js/imce_extras.js
224:  document.cookie = name +'='+ escape(value) +'; expires='+ (new Date(new Date() * 1 + 15 * 86400000)).toGMTString() +'; path=' + Drupal.settings.basePath + 'imce';//set
Miszel’s picture

Assigned: Unassigned » Miszel
Priority: Critical » Major

Ok, I will try the IMCE approach to solve the problem. Thanks for reporting.

joachim’s picture

I tried that on my local test copy and cookies seem to go all wrong and not get set, or perhaps not picked up properly, but then I don't really know what I'm doing in JS :/

rsvelko’s picture

StatusFileSize
new958 bytes

I have a patch.

rsvelko’s picture

Status: Active » Needs review
rsvelko’s picture

prev patch was wrong.

This one works.


--- a/js/eu_cookie_compliance.js
+++ b/js/eu_cookie_compliance.js
@@ -96,7 +96,7 @@ Drupal.eu_cookie_compliance.changeStatus = function(value) {
   }
   var date = new Date();
   date.setDate(date.getDate() + 100);
-  document.cookie = "cookie-agreed-"+Drupal.settings.eu_cookie_compliance.popup_language + "="+value+";expires=" + date.toUTCString() + ";path=/";  
+  document.cookie = "cookie-agreed-"+Drupal.settings.eu_cookie_compliance.popup_language + "="+value+";expires=" + date.toUTCString() + ";path=" + Drupal.settings.basePath;
 }
 



Miszel’s picture

Thanks for that. Committed to the 6.x-1.x branch. Once tested, I will release it.

Miszel’s picture

fixed in 6.x-1.4

Miszel’s picture

Status: Needs review » Closed (fixed)
achton’s picture

Status: Closed (fixed) » Patch (to be ported)

I believe this needs to go in to 7.x and 5.x for consistent behaviour.

Miszel’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

5.x is out of support now. It should go to 7.x though.

Miszel’s picture

Status: Patch (to be ported) » Fixed

in 7.x-1.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 9612d3c on 7.x-1.x, 8.x-1.x, 7.x-2.x by Marcin Pajdzik:
    #1594614 - acceptance cookie is set for all paths: will affect other...
  • Commit 2fecf41 on 7.x-1.x, 8.x-1.x, 7.x-2.x by achton:
    Fixes issue #1594614: cookie subfolder path incorrect.