From bf2cee3989028aaa461e9f0f929724b7738c1399 Mon Sep 17 00:00:00 2001 From: Joe Harvey Date: Wed, 7 Mar 2018 12:59:17 +0000 Subject: [PATCH] Bugfix - Correct duplicate nesting of 'Content' to be returned to template In scenarios where: - No member is logged in - An 'AutoLoginHash' is provided via the 't' (token) query param - The token isn't valid (determined by Member::validateAutoLoginToken()) The message which is intended to be returned to the end-user via $Content in the template, is mistakenly double nested in ['Content' => ['Content' => 'Message']] this leads to "The method forTemplate() doesn't exist on ArrayData" errors. See - https://github.com/silverstripe/silverstripe-framework/issues/7866 --- .../ChangePasswordHandler.php | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Security/MemberAuthenticator/ChangePasswordHandler.php b/src/Security/MemberAuthenticator/ChangePasswordHandler.php index 18bcabc00..21778541f 100644 --- a/src/Security/MemberAuthenticator/ChangePasswordHandler.php +++ b/src/Security/MemberAuthenticator/ChangePasswordHandler.php @@ -112,21 +112,19 @@ class ChangePasswordHandler extends RequestHandler } // Show a friendly message saying the login token has expired if ($token !== null && $member && !$member->validateAutoLoginToken($token)) { - $message = [ - 'Content' => DBField::create_field( - 'HTMLFragment', - _t( - 'SilverStripe\\Security\\Security.NOTERESETLINKINVALID', - '

The password reset link is invalid or expired.

' - . '

You can request a new one here or change your password after' - . ' you logged in.

', - [ - 'link1' => $this->link('lostpassword'), - 'link2' => $this->link('login') - ] - ) + $message = DBField::create_field( + 'HTMLFragment', + _t( + 'SilverStripe\\Security\\Security.NOTERESETLINKINVALID', + '

The password reset link is invalid or expired.

' + . '

You can request a new one here or change your password after' + . ' you logged in.

', + [ + 'link1' => $this->link('lostpassword'), + 'link2' => $this->link('login') + ] ) - ]; + ); return [ 'Content' => $message,