Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cookies]

The tag has no usage guidance.

5
votes
2answers
103 views

Can't find cookie for validation in EventSubscriber

There's this module Splash Redirect in which src/EventSubscriber/SplashRedirectEventSubscriber.php is supposed to check if the cookie $config_cookie exists or not, if it already exists then the user ...
0
votes
0answers
44 views

Performance Considerations When Setting the Cookie Expiration Date

Are there any performance considerations to take into account when setting a Drupal cookie to expire 10 or 20 years in the future? I know it's not possible to set a cookie to never expire as per the ...
0
votes
1answer
52 views

Drupal EU Cookie Compliance module conflict with theme JQuery

When I first installed the module, it'd only appear in admin pages. After some investigation, I discovered the cause was some sort of conflict with my themes jquery: jquery-1.11.2.min.js. If I ...
3
votes
0answers
125 views

How to add 'Set-cookie' header on rest POST response

I have subdomain front.test.local as frontend ngx-app and another subdomain back.test.local for the backend pure Drupal both on https - cookie-domain is set to '.test.local'. I need cookie because ...
0
votes
1answer
421 views

How to correctly use cookies? (Twig and cache context)

In my current project I need to alter node templates depending on previously visited landing page. My idea is that, when a visitor visits one of these landing pages, a cookie will be set, and ...
4
votes
1answer
87 views

What is the difference between a Drupal session variable and a cookie?

When you set a Drupal session variable (i.e. a "magic" variable you may set like this): $_SESSION['mymodule'] = array('key' => 'value'); the value goes away when the user logs out. If you set a ...
0
votes
1answer
292 views

Rest login cookie token explanation

When logging in via a POST to user/login?_format=json I'm sent back a response that looks like this { "current_user": { "uid": "233", "name": "test" }, "csrf_token": "...
0
votes
0answers
60 views

Access Private Tempstore for anonymous user after registration

I try to use the private temp store for anonmyous users, and store information, here only a unique id, but afterwards more information of course. This works. When the user registers the information ...
0
votes
2answers
96 views

How to provide the “Privacy policy link” correctly on EU COOKIE COMPLIANCE module?

After this recent update of the module, when I run a Status Report, it warns me that: “Privacy policy link not provided”, but I actually think I did it by filling up the field “Privacy policy link”, ...
0
votes
1answer
19 views

Clearing Cookies

I have a website and I have configured it such that only once the user accepts the use of cookies on their website, cookies will be enabled. I tried using javascript to delete all cookies on page ...
0
votes
1answer
43 views

CAS module - disabling auto login / want nonpersistent cookies - deleted when browser closes

Our security team says we need to modify the cas module so that it either deletes the session cookies when the browser closes or use a session variable rather than a cookie. I can't figure out how to ...
2
votes
1answer
205 views

Invalidate Internal Page Cache on cookie change

I need to invalidate the Internal Page Cache for anonymous users when the value of a specific cookie changes. How can I implement this? I'm tried to add: $build['#cache']['contexts'][] = 'cookies:my-...
0
votes
3answers
77 views

Subdomain drupal sites cannot read domain cookies

I have set a cookie from domain (.example.co) and its .NET platform & reading those cookie from drupal site(test.example.co). While retrieving it shows empty, I have used $_COOKIE. This link ...
0
votes
1answer
127 views

Why doesn't the view read cookies on AJAX refreshment?

I use views_extras module to get default argument froom cookies. It works ok. But if I set a cookie value using javascript and then refresh a view using ajax the view still shows result for previous ...
0
votes
1answer
125 views

Keep getting “Bad request” messages in browser after adding JS

I have added this script in my Drupal 7 site to make the site remember the last clicked Quicktab and then open that tab on page reload: // JavaScript Document (function($) { Drupal.behaviors....
0
votes
0answers
63 views

Anonymous session not initializing properly in iframe

I have an iframe that loads a url (defined by hook_menu) that returns html and is supposed to check if a session for the anonymous user exists, if not, a session is started using session_id() Once ...
4
votes
2answers
851 views

Increase session timeout

So I have a requirement that I'm getting close to stumped on how to complete in Drupal 8. I'm going to attempt to simplify the requirements. I have two roles. They are essentially mutually exclusive. ...
1
vote
1answer
309 views

WSOD when redirecting based on cookie

I have a site where I set a cookie when the user is visiting a specific content-type: function THEME_preprocess_node(&$variables) { if (isset($variables['node']) && $variables['node']-&...
0
votes
1answer
439 views

How to clear cookie with cookie name on from submit?

When users fill values in node form input fields I set cookies of those values with help of javascript code, example : var date = new Date(); date.setTime(date.getTime() + (60 * 60 * 1000)); ...
0
votes
1answer
40 views

Force a session to become HTTPS?

I'm working with a very complex legacy D7 site, and very complex requirements (bleaugh). Anyway: I'm working on a deeplinking system that allows a jump to the site, which then logs-in a user (this is ...
0
votes
0answers
308 views

Logout on browser close not working

I need to log out a user on browser close. I did following things but it's not working. Copy default.services.yml to services.yml in the same directory and change the cookie_lifetime value 2000000 to ...
0
votes
1answer
490 views

how to secure session cookie in drupal7

I am facing a session cookie hijacking vulnerability please refer the attached image. When i put these cookie in another browser which i simply type the domain like http://example.com and add ...
3
votes
1answer
2k views

Multi-domain cookie

The website I'm working on has 5 domains (two top level and 3 subs, not including www). I need to limit the cookie that the site creates to only work on 4 of the domains. I have found from here that ...
0
votes
2answers
124 views

Can cookies safely be stored in the public filesystem (sites/default/files)?

One of my modules does some CURLing, and to do this it creates a cookie on the Drupal server. Where should I locate this? Where it will be nice and safe? Is there a convention? Is sites/default/files ...
4
votes
2answers
4k views

Headless Drupal 8 - cookie authentication

Disclaimer: not an experienced Drupal dev here, just a junior dev trying to get things done smoothly. Please excuse naive claims or questions. I am successfully using a headless Drupal 8 setup that I ...
0
votes
1answer
57 views

How to highlight new added links on front page with cookies?

My front page contains say 3 different views and each view has 10 rows. My requirement is Links which were not published to the frontpage the last time the user loaded it should be highlighted. I am ...
5
votes
1answer
3k views

How to setup cookie domain?

I am trying to set $cookie_domain in my settings.php within Drupal 8. In Drupal 7, I add this in settings.php to set it up, but I am not sure how to do it in Drupal 8: $cookie_domain = ".domain....
2
votes
1answer
31 views

Drupal 7 sessions wiped after changing settings.php

Yesterday afternoon I had an administrator uncomment and modify the $base_url variable in our production environment. Any changes made in the repository fires off a redeployment which has never been ...
4
votes
0answers
3k views

What cookies does Drupal use? [closed]

I need help with this.. A client wants to write a privacy policy for their site and they are asking what cookies Drupal uses so that they can include a description of them in the policy. Which cookies ...
5
votes
1answer
650 views

How does drupal set user cookie

The following code, let's login any user programmatically. global $user; $user = user_load(<any_uid>); My question is how does the above code triggers to set new user cookies on browser, at ...
6
votes
1answer
690 views

Authenticate using OAuth

I'm working on wrapping my mind around decoupled Drupal 8 while using an AngularJS app for the frontend. What I am trying to do is to allow a user to authenticate with my D8 site using their username ...
0
votes
0answers
1k views

too many redirects issue at production site why?

I have a site and I used redirect module. When I add url redirect then it shows the following message at production site. In firefox browser shows and chrome browser shows: The bn.demo.com page ...
1
vote
1answer
2k views

How do I delete cookies when users log out?

How do I delete cookies when users log out? How can I do this with out modifying any core module?
1
vote
0answers
73 views

EU Compliance for Drupal multidomain (each domain has its own language)

We have developed a multidomain drupal project and each domain has its own language. In other words, each language has assigned its own domain. When we have developed multilanguage sites we have not ...
0
votes
0answers
220 views

Unable to read cookies in page.tpl.php

I am trying to execute the following in page.tpl.php. setcookie('front_page_survey','yes', time() + (86400 * 365), "/"); echo $_COOKIE['front_page_survey'] .'cookie' ; setcookie() works as ...
1
vote
1answer
117 views

Services api set browser cookie

I would like to use Services to programmatically login a user from another website. So for example if site.example.com uses the services login endpoint on example.com in Chrome, when that user moves ...
3
votes
3answers
2k views

Users can't log in sometimes

Drupal 7.5, PHP 5.6.27 Debian 8, remote host. We are running into a problem where some people can't log in some of the time and sometimes it works if they try multiple times. Users have reported the ...
0
votes
0answers
366 views

How to selectively disable cookies?

We have a drupal 7 instances and were wondering how it would be possible to conditionally disable certain cookies for site visitors? We are trying to make sure we are EU cookie compliant. We are ...
1
vote
1answer
49 views

how to remember results of a views query in rules

I have a site with an eva view that is embedded into a view page that is directly accessible, running the query for the first time. To that I have added rules_views, I want to e-mail out certain ...
1
vote
1answer
820 views

How do I modify the “has_js” cookie?

I have a web application deployed through Drupal 7.43. I need to modify the has_js cookie that is set by Drupal to make it both Http-only and Secure for a site security review. What are pros and cons ...
6
votes
2answers
5k views

D8: How Do I Set The Cookie Lifetime

I'm having trouble setting the cookie lifetime in my D8 instance. I'd like to set it to zero so that closing the browser logs-off the user. I've added ini_set('session.cookie_lifetime', 0); to the ...
2
votes
1answer
892 views

How can I make sure a javascript cookie is set before page load?

I am setting a simple javascript cookie and checking it before firing a jquery ui dialog (function ($) { Drupal.behaviors.setPopupConfig = { attach: function (context, settings) { if ($....
0
votes
1answer
1k views

User logout automatically when the browser is closed [duplicate]

I need to logout a user if the browser is closed. I'm using Drupal 8. I tried setting a session cookie in php. But the problem is the cookie should be 'httponly' and 'secure'. Please suggest me the ...
1
vote
1answer
2k views

How to load jquery cookie library for anonymous user

It seems with login user jQuery Cookie added and worked correctly but when I visit my website with not login user(anonymous) then I faced with TypeError: $.cookie is not a function. Why This ...
1
vote
1answer
402 views

Implementing an age check using InboundPathProcessorInterface

I'm trying to create an age checker for a Drupal 8 site. I've created a custom module which has a form where the user enters their DOB and my form submit saves a cookie so I know they have passed ...
0
votes
1answer
361 views

setcookie doesn't work in submit function nor tpl.php

I just copy and pasted set cookie sample code(http://www.w3schools.com/php/php_cookies.asp) to my module and tpl.php In my module, I put the setcookie in my submit function as below: function ...
0
votes
1answer
167 views

Cookie not being created (not a schoolboy error, I hope)

I'm building a deeplink system into a very complex website which needs cookies and other context set-up before the deeplink will work (otherwise the page gets redirected back to the home page - not ...
3
votes
1answer
7k views

How do I set a cookie?

I need to save a cookie for anonymous users in Drupal 8 when users visit the site for the first time, which will be used to display a message. I can successfully save one using setcookie("FirstTimer",...
1
vote
0answers
367 views

Session expires for user logged in by moblie app

I am using drupal 7 services module version 3.x. I do not want my session to be expired. I have set ini_set('session.gc_maxlifetime', 946080000); and ini_set('session.cookie_lifetime', 0); This is ...
0
votes
1answer
104 views

Delete cookie just before render

I am trying to hide the fact that I have a Drupal site (as much as possible). The idea is that if a would be hacker (I am not talking about some ninja that could break into the pentagon) looks at ...