Skip to content

Commit bc60a59

Browse files
author
Garion Herman
authored
Merge pull request #360 from creative-commoners/pulls/4.0/loosen-subsites-conflict
FIX Allow compatibility with patched releases of Subsites 2.2
2 parents 43b0594 + 2781aa3 commit bc60a59

38 files changed

Lines changed: 124 additions & 44 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"squizlabs/php_codesniffer": "^3.0"
3939
},
4040
"conflict": {
41-
"silverstripe/subsites": "<2.3.1"
41+
"silverstripe/subsites": "<2.2.2 || 2.3.0"
4242
},
4343
"suggest": {
4444
"silverstripe/totp-authenticator": "Adds a method to authenticate with you phone using a time-based one-time password.",

src/Authenticator/ChangePasswordHandler.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace SilverStripe\MFA\Authenticator;
46

@@ -205,7 +207,8 @@ public function changepassword()
205207
/** @var Member&MemberExtension $member */
206208
$member = Member::member_from_autologinhash($hash);
207209

208-
if ($hash
210+
if (
211+
$hash
209212
&& $member
210213
&& $member->RegisteredMFAMethods()->exists()
211214
&& !$session->get(self::MFA_VERIFIED_ON_CHANGE_PASSWORD)

src/Authenticator/LoginHandler.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace SilverStripe\MFA\Authenticator;
46

@@ -188,7 +190,8 @@ public function startRegistration(HTTPRequest $request): HTTPResponse
188190
$sessionMember = $store ? $store->getMember() : null;
189191
$loggedInMember = Security::getCurrentUser();
190192

191-
if (($loggedInMember === null && $sessionMember === null)
193+
if (
194+
($loggedInMember === null && $sessionMember === null)
192195
|| !$this->getSudoModeService()->check($request->getSession())
193196
) {
194197
return $this->jsonResponse(
@@ -251,7 +254,8 @@ public function finishRegistration(HTTPRequest $request): HTTPResponse
251254
$sessionMember = $store ? $store->getMember() : null;
252255
$loggedInMember = Security::getCurrentUser();
253256

254-
if (($loggedInMember === null && $sessionMember === null)
257+
if (
258+
($loggedInMember === null && $sessionMember === null)
255259
|| !$this->getSudoModeService()->check($request->getSession())
256260
) {
257261
return $this->jsonResponse(
@@ -284,7 +288,8 @@ public function finishRegistration(HTTPRequest $request): HTTPResponse
284288
// required to log in though. The "mustLogin" flag is set at the beginning of the MFA process if they have at
285289
// least one method registered. They should always do that first. In that case we should assert
286290
// "isLoginComplete"
287-
if ((!$mustLogin || $this->isVerificationComplete($store))
291+
if (
292+
(!$mustLogin || $this->isVerificationComplete($store))
288293
&& $enforcementManager->hasCompletedRegistration($sessionMember)
289294
) {
290295
$this->doPerformLogin($request, $sessionMember);
@@ -447,7 +452,8 @@ public function redirectAfterSuccessfulLogin(): HTTPResponse
447452
// This is potentially redundant logic as the member should only be logged in if they've fully registered.
448453
// They're allowed to login if they can skip - so only do assertions if they're not allowed to skip
449454
// We'll also check that they've registered the required MFA details
450-
if (!$enforcementManager->canSkipMFA($member)
455+
if (
456+
!$enforcementManager->canSkipMFA($member)
451457
&& !$enforcementManager->hasCompletedRegistration($member)
452458
) {
453459
// Log them out again

src/Authenticator/MemberAuthenticator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace SilverStripe\MFA\Authenticator;
34

45
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator as BaseMemberAuthenticator;

src/BackupCode/Method.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace SilverStripe\MFA\BackupCode;
46

src/BackupCode/RegisterHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace SilverStripe\MFA\BackupCode;
46

src/BackupCode/VerifyHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace SilverStripe\MFA\BackupCode;
46

src/Controller/AdminRegistrationController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace SilverStripe\MFA\Controller;
46

@@ -195,7 +197,8 @@ public function removeRegisteredMethod(HTTPRequest $request): HTTPResponse
195197
public function setDefaultRegisteredMethod(HTTPRequest $request): HTTPResponse
196198
{
197199
// Ensure CSRF and sudo-mode protection
198-
if (!SecurityToken::inst()->checkRequest($request)
200+
if (
201+
!SecurityToken::inst()->checkRequest($request)
199202
|| !$this->getSudoModeService()->check($request->getSession())
200203
) {
201204
return $this->jsonResponse(

src/Exception/InvalidMethodException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace SilverStripe\MFA\Exception;
34

45
use LogicException;

src/Extension/AccountReset/MFAResetExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace SilverStripe\MFA\Extension\AccountReset;
46

0 commit comments

Comments
 (0)