Browse files

Using new "Security.login_url" configuration value

  • Loading branch information...
1 parent d0585e4 commit b15b98345f96f57aea4bc0a6e539cc206e42a19c @chillu chillu committed Jan 29, 2013
View
7 code/controllers/ContentController.php
@@ -302,7 +302,12 @@ public function SilverStripeNavigator() {
$surname = Convert::raw2xml($member->Surname);
$logInMessage = _t('ContentController.LOGGEDINAS', 'Logged in as') ." {$firstname} {$surname} - <a href=\"Security/logout\">". _t('ContentController.LOGOUT', 'Log out'). "</a>";
} else {
- $logInMessage = _t('ContentController.NOTLOGGEDIN', 'Not logged in') ." - <a href=\"Security/login\">". _t('ContentController.LOGIN', 'Login') ."</a>";
+ $logInMessage = sprintf(
+ '%s - <a href="%s">%s</a>' ,
+ _t('ContentController.NOTLOGGEDIN', 'Not logged in') ,
+ Config::inst()->get('Security', 'login_url'),
+ _t('ContentController.LOGIN', 'Login') ."</a>"
+ );
}
$viewPageIn = _t('ContentController.VIEWPAGEIN', 'View Page in:');
View
5 tests/controller/ContentControllerPermissionsTest.php
@@ -24,7 +24,10 @@ public function testCanViewStage() {
$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');
View
5 tests/model/SiteTreePermissionsTest.php
@@ -42,7 +42,10 @@ public function testAccessingStageWithBlankStage() {
// 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');

0 comments on commit b15b983

Please sign in to comment.