From f8ec13a1ab5c45cf713d7fcb420a6566b58858bc Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 19 Oct 2010 00:55:20 +0000 Subject: [PATCH] BUGFIX: Themed permissionFailure messages (from r109102) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112780 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- lang/en_US.php | 7 +++---- security/Security.php | 14 ++++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lang/en_US.php b/lang/en_US.php index 594bd425c..c0c556906 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -606,9 +606,8 @@ $lang['en_US']['SearchForm']['GO'] = 'Go'; $lang['en_US']['SearchForm']['SEARCH'] = 'Search'; $lang['en_US']['SearchForm']['SearchResults'] = 'Search Results'; $lang['en_US']['Security']['ALREADYLOGGEDIN'] = array( - 'You don\'t have access to this page. If you have another account that can access that page, you can log in again.', - PR_MEDIUM, - '%s will be replaced with a link to log in.' + 'You don\'t have access to this page. If you have another account that can access that page, you can log in again below.', + PR_MEDIUM ); $lang['en_US']['Security']['BUTTONSEND'] = 'Send me the password reset link'; $lang['en_US']['Security']['CHANGEPASSWORDBELOW'] = 'You can change your password below.'; @@ -870,4 +869,4 @@ $lang['en_US']['WidgetArea']['SINGULARNAME'] = array( 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); -?> \ No newline at end of file +?> diff --git a/security/Security.php b/security/Security.php index db947f75d..26586a952 100644 --- a/security/Security.php +++ b/security/Security.php @@ -173,7 +173,7 @@ class Security extends Controller { 'alreadyLoggedIn' => _t( 'Security.ALREADYLOGGEDIN', "You don't have access to this page. If you have another account that " - . "can access that page, you can log in again.", + . "can access that page, you can log in again below.", PR_MEDIUM, "%s will be replaced with a link to log in." ), @@ -202,12 +202,14 @@ class Security extends Controller { else $message=$messageSet['default']; - // Replace %s with the log in link - $body = sprintf($message, - Controller::join_links(Director::baseURL(), 'Security/login', - '?BackURL=' . urlencode($_SERVER['REQUEST_URI']))); + // Somewhat hackish way to render a login form with an error message. + $me = new Security(); + $form = $me->LoginForm(); + $form->sessionMessage($message, 'warning'); + Session::set('MemberLoginForm.force_message',1); + $formText = $me->login(); - $response->setBody($body); + $response->setBody($formText); return $response; } else if(substr(Director::history(),0,15) == 'Security/logout') {