Skip to content

Commit

Permalink
Code cleanup [SLE-192]
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgfeller committed May 7, 2024
1 parent 517d2b0 commit 4927563
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
13 changes: 0 additions & 13 deletions src/Domain/Home/PhpDevTester.php

This file was deleted.

8 changes: 4 additions & 4 deletions src/Domain/Security/Service/SecurityLoginChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ private function performLoginCheck(array $loginsByIp, array $loginsByEmail, stri
*/
private function performGlobalLoginCheck(): void
{
// Making sure that values returned from repository are cast into integers
// Making sure that values returned from the repository are cast into integers
$loginAmountSummary = array_map('intval', $this->loginRequestFinderRepository->getGlobalLoginAmountSummary());

// Calc allowed failure amount which is the given login_failure_percentage of the total login
$failureThreshold = floor(
$loginAmountSummary['total_amount'] / 100 * $this->securitySettings['login_failure_percentage']
);
// Actual failure amount have to be LESS than allowed failures amount (tested this way)
// Actual failure amount have to be LESS than allowed failures amount (tested this way).
// If there are not enough requests to be representative, the failureThreshold is increased to 20 meaning
// at least 20 failed login attempts are allowed no matter the percentage
// If percentage is 10, throttle begins at 200 login requests
// at least 20 failed login attempts are allowed no matter the percentage.
// If percentage is 10, throttle begins at 200 login requests.
if (!($loginAmountSummary['failures'] < $failureThreshold) && $failureThreshold > 20) {
// If changed, update SecurityServiceTest password spraying test expected error message
$msg = 'Maximum amount of tolerated unrestricted login requests reached site-wide.';
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/User/Data/UserActivityData.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class UserActivityData
public ?string $ipAddress;
public ?string $userAgent;

// When returning the report to the client add the page url
// When returning the report to the frontend add the page url
public ?string $pageUrl = null;
public ?string $timeAndActionName = null; // Time in the correct format and action name with upper case

Expand Down
2 changes: 1 addition & 1 deletion src/Domain/User/Enum/UserStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use App\Common\Trait\EnumToArray;

/**
* User authentication status.
* User status.
*/
enum UserStatus: string
{
Expand Down

0 comments on commit 4927563

Please sign in to comment.