Skip to content

Commit

Permalink
[5.6] Parameter has no usage inside the method. So we better remove i…
Browse files Browse the repository at this point in the history
…t. (#22202)

*  parameter has no usage inside the method. So we better remove it.

* Clearing third decayMinutes parameter form everywhere of tooManyAttempts method call
  • Loading branch information
khanrn authored and taylorotwell committed Nov 29, 2017
1 parent bdfe5a8 commit c2bb45c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Illuminate/Cache/RateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public function __construct(Cache $cache)
*
* @param string $key
* @param int $maxAttempts
* @param float|int $decayMinutes
* @return bool
*/
public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1)
public function tooManyAttempts($key, $maxAttempts)
{
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($key.':timer')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Auth/ThrottlesLogins.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait ThrottlesLogins
protected function hasTooManyLoginAttempts(Request $request)
{
return $this->limiter()->tooManyAttempts(
$this->throttleKey($request), $this->maxAttempts(), $this->decayMinutes()
$this->throttleKey($request), $this->maxAttempts()
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/Middleware/ThrottleRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes

$maxAttempts = $this->resolveMaxAttempts($request, $maxAttempts);

if ($this->limiter->tooManyAttempts($key, $maxAttempts, $decayMinutes)) {
if ($this->limiter->tooManyAttempts($key, $maxAttempts)) {
throw $this->buildException($key, $maxAttempts);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Cache/CacheRateLimiterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testTooManyAttemptsReturnTrueIfAlreadyLockedOut()
$cache->shouldReceive('add')->never();
$rateLimiter = new RateLimiter($cache);

$this->assertTrue($rateLimiter->tooManyAttempts('key', 1, 1));
$this->assertTrue($rateLimiter->tooManyAttempts('key', 1));
}

public function testHitProperlyIncrementsAttemptCount()
Expand Down

0 comments on commit c2bb45c

Please sign in to comment.