Skip to content

Commit 2781aa3

Browse files
author
Garion Herman
committed
FIX linting errors
1 parent 1652e9e commit 2781aa3

37 files changed

Lines changed: 123 additions & 43 deletions

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

src/Extension/AccountReset/MemberExtension.php

Lines changed: 7 additions & 3 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\Extension\AccountReset;
46

@@ -45,9 +47,11 @@ public function generateAccountResetTokenAndStoreHash(): string
4547
do {
4648
$token = $generator->randomToken();
4749
$hash = $this->owner->encryptWithUserSettings($token);
48-
} while (DataObject::get_one(Member::class, [
50+
} while (
51+
DataObject::get_one(Member::class, [
4952
'"Member"."AccountResetHash"' => $hash,
50-
]));
53+
])
54+
);
5155

5256
$this->owner->AccountResetHash = $hash;
5357
$this->owner->AccountResetExpired = DBDatetime::create()->setValue(

0 commit comments

Comments
 (0)