From b15b98345f96f57aea4bc0a6e539cc206e42a19c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 29 Jan 2013 17:31:25 +0100 Subject: [PATCH] Using new "Security.login_url" configuration value --- code/controllers/ContentController.php | 7 ++++++- tests/controller/ContentControllerPermissionsTest.php | 5 ++++- tests/model/SiteTreePermissionsTest.php | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php index 5f67e6b7..0eb8cc01 100644 --- a/code/controllers/ContentController.php +++ b/code/controllers/ContentController.php @@ -302,7 +302,12 @@ class ContentController extends Controller { $surname = Convert::raw2xml($member->Surname); $logInMessage = _t('ContentController.LOGGEDINAS', 'Logged in as') ." {$firstname} {$surname} - ". _t('ContentController.LOGOUT', 'Log out'). ""; } else { - $logInMessage = _t('ContentController.NOTLOGGEDIN', 'Not logged in') ." - ". _t('ContentController.LOGIN', 'Login') .""; + $logInMessage = sprintf( + '%s - %s' , + _t('ContentController.NOTLOGGEDIN', 'Not logged in') , + Config::inst()->get('Security', 'login_url'), + _t('ContentController.LOGIN', 'Login') ."" + ); } $viewPageIn = _t('ContentController.VIEWPAGEIN', 'View Page in:'); diff --git a/tests/controller/ContentControllerPermissionsTest.php b/tests/controller/ContentControllerPermissionsTest.php index 3d8edc21..e8ce8eb0 100644 --- a/tests/controller/ContentControllerPermissionsTest.php +++ b/tests/controller/ContentControllerPermissionsTest.php @@ -24,7 +24,10 @@ class ContentControllerPermissionsTest extends FunctionalTest { $response = $this->get('/testpage/?stage=Stage'); // should redirect to login $this->assertEquals($response->getStatusCode(), 302, 'Redirects to login page when not logged in for draft stage'); - $this->assertContains('Security/login', $response->getHeader('Location')); + $this->assertContains( + Config::inst()->get('Security', 'login_url'), + $response->getHeader('Location') + ); $this->logInWithPermission('CMS_ACCESS_CMSMain'); diff --git a/tests/model/SiteTreePermissionsTest.php b/tests/model/SiteTreePermissionsTest.php index 582395c3..e805b888 100644 --- a/tests/model/SiteTreePermissionsTest.php +++ b/tests/model/SiteTreePermissionsTest.php @@ -42,7 +42,10 @@ class SiteTreePermissionsTest extends FunctionalTest { // should be prompted for a login $response = $this->get($page->URLSegment . '?stage=Stage'); $this->assertEquals($response->getStatusCode(), '302'); - $this->assertContains('Security/login', $response->getHeader('Location')); + $this->assertContains( + Config::inst()->get('Security', 'login_url'), + $response->getHeader('Location') + ); $this->logInWithPermission('ADMIN');