Questions tagged [session]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8
votes
2answers
5k views

Can you save a variable in session?

Is there any way to save a variable in the Craft session inside a controller? I'm running a cron job and I need to store a variable as a session for every run to see if a condition matches.
6
votes
2answers
2k views

Getting logged out of admin area when refreshing site

The problem seem to be that the session file in /craft/storage/runtime/sessions is getting removed any time I refresh the actual page, so that I have to do a new login everytime I've changed content, ...
4
votes
2answers
460 views

Limit number of sessions per user

Is there a way to limit the number of sessions per user? That is, I can be logged into one machine/browsers only once. It is essential that we limit the number of times a user can be logged in and I ...
4
votes
2answers
2k views

Getting session Id in twig template

Is there a way to get the session id from craft.session in a twig template without needing to create a new filter?
4
votes
1answer
445 views

How can I disable sessions for most of my Craft site?

We're running a craftcms-backed site that uses sessions only for the admin pages. For a few reasons, we'd like to disable session logic for all other urls: the Set-Cookie header that craft uses to ...
3
votes
1answer
299 views

Keep on getting logged out when deploying using Capistano

I keep on getting logged out whenever I deploy using Capistrano, despite the sessions being stored persistently (in the craft/storage folder).
3
votes
1answer
1k views

Using PHP Redis as Session Store

I'm trying to use php-redis as the session store to my craftcms site. What I've tried: apt-get install php5-redis Edited php.ini with the following: session.save_handler = redis session.save_path = "...
3
votes
1answer
269 views

Is it possible to override the default session notices?

I couldn't find anything on here about this. Maybe I'm the only one, but for example when you log in there is a session notice with the message "Logged in.", but I want it to display something like "...
3
votes
1answer
1k views

What's the difference between CraftSessionId and a normal PHP session?

Doing some testing, and stumbled across the "CraftSessionId" cookie... What's the difference between CraftSessionId and a normal PHP session? Is there any difference at all? What's the best way to ...
3
votes
1answer
52 views

Generating thumbnails when using a memcache server for session storage frequently signs users out

I can't figure out why, but when I'm connected to a memcache server the thumbnail generation process in Assets hangs for long periods of time, the getElements process throws 403 errors, the generating ...
3
votes
0answers
103 views

Can you make Craft 2 Stateless?

So we are moving to Google App Engine Flexible which means we cannot store sessions on files. So I wanted to know if anyone has been able to make Craft 2 Stateless and how was it accomplished? Thanks....
2
votes
3answers
994 views

How can I store Craft sessions in the database?

Is it possible to configure Craft 3 to store session data in the database? On some other CMS's this can be enabled. The reason I'm exploring this is because we're having an issue whereby PHP sessions ...
2
votes
3answers
1k views

CometChat integration

I need to implement Comet Chat, a facebook-chat-like third-party script, into my Craft project. Comet Chat can connect to most CMS and PHP framework but there is no Craft integration yet, so I tried ...
2
votes
2answers
875 views

"Your session has ended" modal popping up constantly

I know many other folks have posted this question over the years, but unfortunately none of the answers given so far are fixing this for me. The problem: after logging-in on my staging server (this ...
2
votes
2answers
1k views

Using the CP login session expiration for the frontend

I love the session handling on the backend CP. The prompts that come up on session expiration after setting 'userSessionDuration' => 'PT5M', in config/general.php are exactly what I want to use on ...
2
votes
1answer
338 views

Is it possible to change the amount of time a user stays logged in for?

Our users are getting logged out after 1 day. Is there a setting that changes how long users’ sessions will last?
2
votes
1answer
1k views

Craft CMS 3 - Redis Sessions cause error

I've configured Redis to handle cache and sessions for Craft 3, and while cache configuration is working as expected, I had to disable session configuration due to the below error. It fails on the ...
2
votes
2answers
1k views

CP Session expires after short time

Our Craft installation is now working on the Production Cloud-Server, except that if I'm logged in the CP, after maybe 30 sec the login-modal pops up and says that the session has expired. If I just ...
2
votes
1answer
912 views

Does Craft have any default keys for flash messages?

Does Craft have any default keys for flash messages like logging in or updating a profile?
2
votes
1answer
696 views

Craft with Redis session handling

We've recently set up a Redis cluster to handle our PHP sessions since we use a load balancer to direct traffic into different craft instances. We're seeing issues with redis when making back to back ...
2
votes
1answer
215 views

How can I set a persistent template variable to use across multiple pages in one site visit?

I'm working on a site where the site background is chosen randomly from among the entries in an "artwork" channel. I'm using the following code in my _layout.html template to get the url for the ...
2
votes
1answer
348 views

How can I debug `craft\web\User::_validateUserAgentAndIp()` warnings

On a production site, we're seeing a ton of the following warning in our web.log files for (seemingly) every request, creating a ton of noise in the logs and making it hard to spot "real" issues: &...
1
vote
2answers
213 views

How can I disable/decrease the number of calls to getAuthTimeout?

The host of a client is claiming the call to getAuthTimeout is triggering their firewall, and in turn blocks my client from accessing their site for a longer duration. Is there a way to disable or ...
1
vote
1answer
374 views

__PHP_Incomplete_Class retrieved from session

I am storing a plugin model in session: $sessionModel = My_Model::populateModel([ 'token' => 'someData' ]); craft()->httpSession->add('someKey', $sessionModel); When I retrieve that ...
1
vote
4answers
429 views

Migrated site - now dashboard keeps logging out

I've migrated my client's Craft site to a new host. On the front end the site is fine and working as it should. The problem is with the Craft admin area. I can login, but once logged I can’t access ...
1
vote
1answer
394 views

Implementing SimpleSAML PHP in Craft plugin

We have been trying to implement SimpleSAML PHP in a Craft plugin to facilitate a SAML login for one of our sites. The problem we are running into is that we always get the NOSTATE error. The ...
1
vote
1answer
156 views

Can I manage/change the default flash message text?

I am looking to customise the default flash message text for certain behaviours but cannot seem to find any reference to them in the code or control panel - does this exist anywhere? And could it be ...
1
vote
1answer
896 views

Is it safe to remove the craft/storage/runtime/sessions folder?

I'm unable to transfer a site over to my development server because I keep getting problems with disk space. Space is actually fine, it's the number of inodes being used up. Using cPanel I get an ...
1
vote
1answer
563 views

Getting error "Your session has ended. Enter your password to log back in." every 30 seconds or so

This is happening for all users and only on production environment. "Your session has ended. Enter your password to log back in." Entering your password does not allow you to actually see the admin ...
1
vote
1answer
180 views

conditional does not run first in a file that is included using the extends feature for twig

I have this conditional included in a layout file I use within others, using the extends feature in twig. This is at the very top of _layouts/application.twig {% if not currentUser %} {% ...
1
vote
1answer
159 views

Getting 'signed out' after exactly 1 minute of inactivity

I've launched a site recently which is being hosted on Vidahost's Cloud servers. After exactly 1 minute of inactivity, anyone using the control panel is signed out. Except that if you refresh the page ...
1
vote
1answer
742 views

How should I set an arbitrary session value in a plugin?

I have some data I want to store in session: $data = array ( 'id' => '23539471' 'token' => 'cf310b81-9431-4303-804d-c1635ae29278' ); In my plugin I am doing this: new HttpCookie('...
1
vote
1answer
138 views

Craft 2 Commerce 1 cart session expiry

Is it possible to change the cookie timeout just for the cart? E.g. I'd like to clear abandoned carts after X hours and keep all the other sessions untouched (e.g. user sessions etc). Please advise ...
1
vote
2answers
176 views

Craft login problem with memcache and ubuntu?

session_regenerate_id(): Session object destruction failed is the error i'm receiving after attempting to log in. I just updated to Ubuntu 16.04LTS using PHP7 and php-memcached. Is there a fix for ...
1
vote
2answers
501 views

Control Panel Session 60 second Timeout

I’m on Craft v. 2.6.2983 and am encountering the well flagged issue of the control panel logging me out after 60 seconds. I've tried most of the solutions posted here and have had no success in ...
1
vote
2answers
331 views

Session destroy due to inactivity?

It seems that after x amount of time (somewhere between 30-60 mins?) of inactivity on a page the session is being destroyed/cleared/etc. I will sit on a page with an active session for an hour and ...
1
vote
2answers
8k views

Session related question - opening browser with multiple tabs

We are having a situation wherein the users are trying to open URLs in the same browser with multiple tabs, while doing that the session variables which store unique identifiers are overwritten. Is ...
1
vote
1answer
24 views

Set Session variable inside php controller

I'm from custom php world but It looks like I can't just set a session variable in plain php. I'm playing around use craft\web\Session; ... $session = new Session(); $session->open(); $session->...
1
vote
1answer
65 views

Craft 2.6 Session Issues

We are having issues staying logged in to Craft (2.6). There was a plugin error which is what we thought was causing the issues, so we removed the sprout SEO plugin. However the error still persists. ...
1
vote
1answer
75 views

Craft redirects to domain.tld/domain.tld/ on logout

I have a logout button on my site that points to the logoutUrl. While the logout works and ends the user session, the user is brought to a page with the URL similar to domain.tld/domain.tld/ where ...
1
vote
1answer
113 views

Craft 2 CP session expires unexpectedly, requires repeated login

Environment Craft: 2.6.3013 (Personal) MAMP Pro: 4.4.1 PHP: 7.0.12 (CGI Mode) Behavior After logging into the CP, and following a relatively short period of time, the session expires unexpectedly and ...
1
vote
1answer
198 views

Craft cacheMethod setting is being overridden

I am trying to setup Craft to use a memcached (yes it is memcached, not memcache) cluster in AWS ElastiCache to handle sessions. I originally went the route of updating my php.ini file in Apache2 to ...
1
vote
1answer
161 views

With two EC2 Craft instances, the Control Panel session keeps expiring

Things were fine (no session logout for admin from CP) when there was only one EC2 instance for our website. I created a replica of the existing EC2 instance and now when I go to Control Panel, ...
1
vote
1answer
687 views

Session cookies

I'm in the process of adding a second site to a Craft installation using custom locales. The two sites will be accessed on different sub-domains, e.g. site1.domain.com and site2.domain.com. I need to ...
1
vote
1answer
263 views

How do I preserve user sessions across subdomains?

I have defaultCookieDomain set to .site.com I am logged into www.site.com I expected to also be logged into sub.site.com (which is pointing to the same web root), but I'm not. What am I missing?
1
vote
1answer
175 views

Craft/Yii not garbage collecting session?

I want to store a session value and have that cleared after a set timeout. I’ve got PHP's session.gc_maxlifetime set at 60 seconds for development and am using Craft’s HttpSessionService to set a ...
1
vote
1answer
408 views

Strange issue with logging out user on frontend

We have a strange issue with a site we are developing. We have a user login on the front-end of the site which takes users to their profile pages. The issue we have is that on a Mac the user is being ...
1
vote
2answers
496 views

Logging in Every Minute - Craft Admin Sessions (on Heroku)

I have Craft installed on Heroku using Memcached for sessions. Craft is kicking me out of the admin area every minute or two. It's deriving me crazy. I've also set the user session duration in general....
1
vote
1answer
748 views

User not being logged out when visiting {{ logoutUrl }} link

I have a login area on a site which basically just shows a users profile fields. I'm using the {{ logoutUrl }} tag for my logout link and when the user goes to the logoutUrl they're redirected to the ...
1
vote
1answer
152 views

sessions being read inconsistently

I've got a navigation bar that displays different links for logged in users using {% if currentUser %}. However, when clicking through links, sometimes it won't pick up that someone is logged in. The ...