-
Notifications
You must be signed in to change notification settings - Fork 19
Automatic login troubleshooting
Automatic login is a quite delicate process. The raidplaner will look for the session information of an active binding (e.g. PHPBB) and try to use that information to log in.
Sessions however are stored in cookies. The "problem" with cookies is that they are bound to a) a specific domain and b) a specific path, which means if one of the two doesn't match the cookie is not send to the web server.
Let's have a look at an example.
- In our case PHPBB3 is installed in the folder "board" on a webspace and can be accessed via http://www.guild.com/board.
- The raidplaner is installed in the folder "raidplaner" on the same webspace and can be accessed via http://www.guild.com/raids.
If the board now creates a cookie that cookie will say "I belong to 'guild.com' and the folder 'board'".
If a user requests http://www.guild.com/board that cookie will be sent. However, if a user opens up http://www.guild.com/raid that cookie will not be sent because the folder "raid" does not match "board".
Now let's move the raidplaner to http://www.guild.com/board/raid.
If a user now requests that address the cookie will be sent because "board/raid" matches "board" ("raid" is a subfolder of "board").
The previous example already showed a solution: move the raidplaner to a subfolder of your board.
If you don't want to do that things may become a little tricky. From the previous examples you can see that the raidplaner itself cannot change the cookie path as the session cookie is created by the board.
So you need to change the board's settings. And that is not always easy to do.
In case of our previous example the cookie path should be set to "/" as this is the first folder both folders share as a parent.
To make it a little clearer: if your board is installed on http://www.guild.com/1/2/board and the raidplaner is installed on http://www.guild.com/1/raidplaner the cookie path should be set to "/1" as this is the first shared parent folder.
Drupal uses the session.cookie_path from the php.ini.
If you don't have access to the global php.ini or you don't want to modify it you can add a the following directive to the .htaccess file in your drupal directory.
If the file does not exist just create it and add the following line. If the .htaccess file already exists look for <IfModule mod_php5.c> and just add the line starting with php_value.
<IfModule mod_php5.c>
php_value session.cookie_path "/Your/Cookie/Path/Here"
</IfModule>
- Open the "Administration panel"
- Select "General Admin" -> "Settings"
- Go to the tab "System"
- Adjust the "Cookie Path" setting below "Cookie Settings"
- Open up the Administrator tool
- Go to "System" -> "Global Configuration"
- Go to the tab "Site" (should be open already)
- Adjust the setting "Cookie Path" below "Cookie Settings"
- Open up the Admin CP
- Go to the tab "Configuration"
- Click on "General Configuration"
- Adjust the setting "Cookie Path"
- Open the administrator panel
- Go to the tab "General" (should be open already)
- Go to "Cookies"
- Adjust the setting "Cookie-Path"
The cookie path is generated from the forum URL which sadly cannot be changed without breaking things. If someone knows a more elegant solution, please send me a message:
- Open the file "Sources/Security.php" and "Sources/Subs-Auth.php"
- Look for all appearances of the function
setcookie(... - Replace
$cookie_url[1]to the cookie path you want to use (e.g. '/')
- Open the file "conf/config-defaults.php"
- Change the line
$Configuration['Garden']['Cookie']['Path'] = '/';to$Configuration['Garden']['Cookie']['Path'] = '/Your/Cookie/Path/Here';
- Open the Admin CP
- Choose "Settings" -> "Options"
- Select "Cookies and HTTP Header Options" and click "Edit Settings"
- Select one of the suggested paths below "Path to Save Cookies" or enable "Use Custom Setting" and define your path below
WBB does not seem to set a cookie path so it should alway be '/'.
This means automatic login should always work by default.
- Open the file "wp-config.php"
- Add the following line or change it to
define('COOKIEPATH', '/Your/Cookie/Path/Here');