UrlHelper::dir() always returns a trailing slash, so the session cookie was scoped to "/kanboard/". That cookie is not sent back for "/kanboard", which is exactly the url the bundled web.config and .htaccess serve the application on: both rewrite to index.php whenever the request is not a file, so the directory url is never redirected to its trailing-slash form. The first login then stores redirectAfterLogin="/kanboard", redirects there after a successful check, arrives without the session cookie and bounces back to the login form with no error message. Use the directory without the trailing slash, which is what the browser would have picked as the default cookie path anyway and still matches every url below it.
39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace KanboardTests\units\Core\Session;
|
|
|
|
use KanboardTests\units\Base;
|
|
use Kanboard\Core\Http\Request;
|
|
use Kanboard\Core\Session\SessionManager;
|
|
|
|
class SessionManagerTest extends Base
|
|
{
|
|
public function testCookiePathAtRoot()
|
|
{
|
|
$this->assertEquals('/', $this->buildSessionManager('/index.php')->getCookiePath());
|
|
}
|
|
|
|
public function testCookiePathInSubDirectoryHasNoTrailingSlash()
|
|
{
|
|
$this->assertEquals('/kanboard', $this->buildSessionManager('/kanboard/index.php')->getCookiePath());
|
|
}
|
|
|
|
public function testCookiePathInNestedSubDirectoryHasNoTrailingSlash()
|
|
{
|
|
$this->assertEquals('/apps/kanboard', $this->buildSessionManager('/apps/kanboard/index.php')->getCookiePath());
|
|
}
|
|
|
|
private function buildSessionManager($phpSelf)
|
|
{
|
|
$this->container['request'] = new Request(
|
|
$this->container,
|
|
array(
|
|
'PHP_SELF' => $phpSelf,
|
|
'REQUEST_METHOD' => 'GET',
|
|
)
|
|
);
|
|
|
|
return new SessionManager($this->container);
|
|
}
|
|
}
|