Skip to content

Commit

Permalink
change: rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoraddatz committed Sep 17, 2024
1 parent 46a0318 commit bed1b7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Requests/CodeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static function runsOnAllowedEnvironment(?string $environment = null): bo
&& in_array($environment, config('totp-login.superpin.environments', ['local', 'testing']), true);
}

public static function bypassesEnvironment(?string $identifier = null): bool
public static function bypassesRestrictions(?string $identifier = null): bool
{
return filled($identifier)
&& in_array($identifier, config('totp-login.superpin.bypassing_identifiers', []), true);
Expand All @@ -128,7 +128,7 @@ public function validateCode(): void
return;
}

if ($codeMatchesSuperPin && self::bypassesEnvironment($this->user->{config('totp-login.columns.identifier')})) {
if ($codeMatchesSuperPin && self::bypassesRestrictions($this->user->{config('totp-login.columns.identifier')})) {
return;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/HandleCodeRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public function test_runs_on_allowed_environment(): void
$this->assertTrue(CodeRequest::runsOnAllowedEnvironment('staging'));
}

public function test_bypasses_environment(): void
public function test_bypasses_restrictions(): void
{
$this->assertFalse(CodeRequest::bypassesEnvironment(''));
$this->assertFalse(CodeRequest::bypassesEnvironment());
$this->assertFalse(CodeRequest::bypassesRestrictions(''));
$this->assertFalse(CodeRequest::bypassesRestrictions());

Config::set('totp-login.superpin.pin', 333333);
Config::set('totp-login.superpin.environments', ['non-existing']);
Expand All @@ -49,7 +49,7 @@ public function test_bypasses_environment(): void
];

foreach ($data as $email => $expected) {
$this->assertEquals($expected, CodeRequest::bypassesEnvironment($email), $email);
$this->assertEquals($expected, CodeRequest::bypassesRestrictions($email), $email);
}
}
}

0 comments on commit bed1b7d

Please sign in to comment.