From 8d23cfc2aaa2b57fa8687062ce546095a3a5e2a3 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 23 Jun 2017 10:54:50 +1200 Subject: [PATCH] FIX Ensure LoginForm on ContentController can load the member authenticator correctly --- code/Controllers/ContentController.php | 5 ++++- tests/controller/ContentControllerTest.php | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/Controllers/ContentController.php b/code/Controllers/ContentController.php index 13c26ba2..a74997e4 100644 --- a/code/Controllers/ContentController.php +++ b/code/Controllers/ContentController.php @@ -9,6 +9,7 @@ use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse_Exception; use SilverStripe\Core\Convert; +use SilverStripe\Core\Injector\Injector; use SilverStripe\i18n\i18n; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataObject; @@ -17,6 +18,7 @@ use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\FieldType\DBVarchar; use SilverStripe\ORM\SS_List; +use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator; use SilverStripe\Security\Permission; use SilverStripe\Security\Security; use SilverStripe\SiteConfig\SiteConfig; @@ -311,10 +313,11 @@ class ContentController extends Controller * * @todo Check if here should be returned just the default log-in form or * all available log-in forms (also OpenID...) + * @return \SilverStripe\Security\MemberAuthenticator\MemberLoginForm */ public function LoginForm() { - return MemberAuthenticator::singleton()->loginForm($this); + return Injector::inst()->get(MemberAuthenticator::class)->getLoginHandler($this->Link())->loginForm(); } public function SilverStripeNavigator() diff --git a/tests/controller/ContentControllerTest.php b/tests/controller/ContentControllerTest.php index 14a03ebc..604a3edc 100755 --- a/tests/controller/ContentControllerTest.php +++ b/tests/controller/ContentControllerTest.php @@ -204,4 +204,3 @@ class ContentControllerTest extends FunctionalTest }); } } -