ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Editors constantly logged out of CP

October 20, 2011 11:50pm

Subscribe [4]
  • #1 / Oct 20, 2011 11:50pm

    Calan

    104 posts

    Hiya,

    I have 2 editors out in South Africa who are having major problems with the CP. On both their computers, regardless of browser, they are logged out of the CP when trying to save an entry. Similarly, if they try upload an image through the file manager they are logged out.

    I’ve tested every combination of security and session settings with no success. I’ve also logged in using their details and I have no problem performing those actions.

    This seems very strange. It’s the latest version of EE, though they have similar problems with older versions.

    The other strange part is that if they create/edit content via the Solspace User module on the front-end, then they don’t have a problem, the content is saved and they can carry on.

    Very frustrating.

    Calan

  • #2 / Oct 23, 2011 8:52am

    Sue Crocker

    26054 posts

    Hi, Calan.

    Can you make sure you’re using Cookies Only and try turning off secure forms and requiring ip addresses.

    You can make these changes in your config.php file:

    $config['cookie_domain'] = "";
    $config['cookie_path'] = "";
    $config['cookie_prefix'] = "";
    $config['admin_session_type'] = "c";
    $config['user_session_type'] = "c";
    $config['require_ip_for_login'] = "n";
    $config['require_ip_for_posting'] = "n"; 
    $config['secure_forms'] = "n";
  • #3 / Oct 23, 2011 12:54pm

    airways

    154 posts

    Calan,

    You may want to take a look at this thread where I had a similar issue: http://ellislab.com/forums/viewthread/199884/

    The fix for me was to disable part of a SQL query in the core Session.php file. It’s a very small and easy to make change. Unfortunately, the “require_ip_*” options you can set in the config file do not disable this option, so your sessions will still be invalidated if the user’s IP address is changing.

    Verifying that this will solve your issue is a bit more challenging, depending on how familiar with PHP you are. You should make a backup of all of your site files and DB (and know how to restore it) before proceeding. You may also want to notify your editors that the CP may go down briefly while you are working on this (although it is very unlikely).

    First SSH into your server and create a new log directory and make it writable:

    $ mkdir ~/eelog
    $ touch ~/eelog/cp.log
    $ chmod -R 777 ~/eelog

    Now we need to get the path to the log file.

    $ cd ~/eelog
    $ pwd
    /home/USER/eelog

    Whatever value you get from pwd, place into the first ini_set() in the following lines at the top of fetch_session_data() in the file system/expressionengine/libraries/Session.php:

    public function fetch_session_data()
    {
            // debug logging to determine if IP address is changing for users
            ini_set("error_log","/home/USER/eelog/cp.log");
            ini_set("log_errors",1);
            error_log("ip_address = [[".$this->sdata[‘member_id’]." : ".$this->sdata[‘ip_address’]."]]";

    Now watch the log file, this will print any new text added to the file instantly to your console output. Press Ctrl+C to kill the watch command after you are done.

    $ watch -f ~/eelog/cp.log

    Test the setup with your own account and you should see your member_id and IP address listed in the log. After you’re sure that it’s all working, ask the users to continue their work and see if their IP address changes. You’ll need to know each user’s member_id in order to tell who’s IP address you’re seeing.

    If the value printed out for ip_address in the log file changes for the same user, you probably need to comment out the ip_address in the same function. Modify the code so that it looks like this:

    public function fetch_session_data()
    {
            // Look for session.  Match the user's IP address and browser for added security.
            $this->EE->db->select('member_id, admin_sess, last_activity')
                         ->where('session_id', (string) $this->sdata['session_id'])
                         // disable ip_address check
                         // ->where('ip_address', $this->sdata['ip_address'])
                         ->where('user_agent', $this->sdata['user_agent']);

    After running this I recommend removing the two init_set() and error_log() calls and deleting the eelog directory:

    $ rm -rf ~/eelog
  • #4 / Oct 24, 2011 9:32am

    Calan

    104 posts

    @Sue - Hiya, thanks for the help but I’d already done all that and was still getting kicked out constantly.

    @airways - Thanks so much, it has done the trick. Very very much appreciated.

    Sue, it may be worth forwarding this thread to the devs for a look for future CP settings. It has been incredibly frustrating and my content team has been unable to work for a number of days. I realise this type of problem is quite isolated but pretty tricky to solve for those it does affect.

    Thanks again for the help 😊

    Calan

  • #5 / Oct 24, 2011 11:01am

    airways

    154 posts

    No problem, glad I could help!

  • #6 / Oct 25, 2011 5:21pm

    Dan Decker

    7338 posts

    Calan,

    I’m glad airways was able to point you in the right direction. Keep in mind going forward that these changes will need to be tracked through future versions of ExpressionEngine. If you need assistance in the future, please let us know in a new thread.

    airways, thanks for the assist! A very thorough solution.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases