Project

General

Profile

Actions

Bug #58881

closed

Login failed for TYPO3 in sub directory caused by fe_typo_user cookie

Added by Bill Dagou almost 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-05-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hi,

I just got this problem when I was working on my current project.

The idea is after people fills in a form in the TYPO3 located at the document root, the system would set up a new one in a sub directory with FE user login feature.

http://www.domain.com/ <- people fills the form here
http://www.domain.com/client1/ <- generated by code or script

However, as there would be 2 fe_typo_user cookies, the one for /client1/ would not work when people login.

Cheers,
Bill

Actions #1

Updated by Bill Dagou almost 10 years ago

I changed t3lib_userAuth::getCookie(), and seems it's working for me. See my code below.

    protected function getCookie($cookieName) {
        if (isset($_SERVER['HTTP_COOKIE'])) {
            $cookies = t3lib_div::trimExplode(';', $_SERVER['HTTP_COOKIE']);
            foreach ($cookies as $cookie) {
                list ($name, $value) = t3lib_div::trimExplode('=', $cookie);
                if (strcmp(trim($name), $cookieName) == 0) {
                        // Use the first one
                    $cookieValue = urldecode($value);

                    break;
                }
            }
        } else {
                // Fallback if there is no HTTP_COOKIE, use original method:
            $cookieValue = isset($_COOKIE[$cookieName]) ? stripslashes($_COOKIE[$cookieName]) : '';
        }
        return $cookieValue;
    }

Actions #2

Updated by Mathias Schreiber over 8 years ago

  • Status changed from New to Closed

fixed on master

Actions

Also available in: Atom PDF