Using new "Security.login_url" configuration value

This commit is contained in:
Ingo Schommer 2013-01-29 17:31:25 +01:00
parent d0585e484a
commit b15b98345f
3 changed files with 14 additions and 3 deletions

View File

@ -302,7 +302,12 @@ class ContentController extends Controller {
$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 File

@ -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');

View File

@ -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');