Merge branch '4.9' into 4.10

This commit is contained in:
Steve Boyd 2021-12-16 10:58:13 +13:00
commit 8b3bec9c68
4 changed files with 35 additions and 2 deletions

View File

@ -113,5 +113,9 @@ class SessionAuthenticationHandler implements AuthenticationHandler
{
$request = $request ?: Controller::curr()->getRequest();
$request->getSession()->destroy(true, $request);
if (Member::config()->get('login_marker_cookie')) {
Cookie::force_expiry(Member::config()->get('login_marker_cookie'));
}
}
}

View File

@ -372,7 +372,7 @@ class i18nTextCollector
// For each module do a simple merge of the default yml with these strings
foreach ($entitiesByModule as $module => $messages) {
// Load existing localisations
$masterFile = "{$this->basePath}/{$module}/lang/{$this->defaultLocale}.yml";
$masterFile = "{$this->basePath}/vendor/{$module}/lang/{$this->defaultLocale}.yml";
$existingMessages = $this->getReader()->read($this->defaultLocale, $masterFile);
// Merge

View File

@ -4,13 +4,15 @@ namespace SilverStripe\Security\Tests\MemberAuthenticator;
use SilverStripe\Control\Cookie;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\Session;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Security\Member;
use SilverStripe\Security\MemberAuthenticator\SessionAuthenticationHandler;
class SessionAuthenticationHandlerTest extends SapphireTest
{
protected static $fixture_file = 'SessionAuthenticationHandlerTest.yml';
protected $usesDatabase = true;
/**
@ -58,4 +60,20 @@ class SessionAuthenticationHandlerTest extends SapphireTest
$this->assertNotNull($matchedMember);
$this->assertEquals($matchedMember->Email, $member->Email);
}
public function testLoginMarkerCookie()
{
Config::modify()->set(Member::class, 'login_marker_cookie', 'sslogin');
/** @var Member $member */
$member = $this->objFromFixture(Member::class, 'test');
$this->logInAs($member);
$this->assertNotNull(Cookie::get('sslogin'), 'Login marker cookie is set after logging in');
$this->logOut();
$this->assertNull(Cookie::get('sslogin'), 'Login marker cookie is deleted after logging out');
}
}

View File

@ -0,0 +1,11 @@
'SilverStripe\Security\Group':
usergroup:
Title: usergroup
Code: usergroup
'SilverStripe\Security\Member':
test:
FirstName: Test
Surname: User
Email: testuser@example.com
Password: 1nitialPassword
Groups: '=>SilverStripe\Security\Group.usergroup'