Skip to content

Commit

Permalink
rate limit by default none
Browse files Browse the repository at this point in the history
  • Loading branch information
cesargb committed Jan 8, 2025
1 parent 0d519df commit 4511bb5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ MAGICLINK_DELETE_MASSIVE=false
## Customization

### Config

To custom this package you can publish the config file:

```bash
Expand Down Expand Up @@ -440,12 +441,13 @@ return a `view()`
You can limit the number of requests per minute for a magic link. To do this, you need to
set the `MAGICLINK_RATE_LIMIT` environment variable to the desired value.

By default, the rate limit is 100 attempts per minutes. Use `none` to disable the rate limit.
By default, the rate limit is disable with value 'none', but you can set a value
to limit the requests. For example, to limit the requests to 100 per minute, set

```bash
# .env

MAGICLINK_RATE_LIMIT='none'
MAGICLINK_RATE_LIMIT=100
```

## Testing
Expand Down
4 changes: 2 additions & 2 deletions config/magiclink.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
|
| Here you may specify the number of attempts to rate limit per minutes
|
| Default: 100, if you want to disable rate limit, set as 'none'
| Default: none, if you want to enable rate limit, set as integer
*/
'rate_limit' => env('MAGICLINK_RATE_LIMIT', 100),
'rate_limit' => env('MAGICLINK_RATE_LIMIT', 'none'),

'token' => [
/*
Expand Down
2 changes: 1 addition & 1 deletion src/MagicLinkServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function boot()

private function registerRateLimit(): void
{
$rateLimit = config('magiclink.rate_limit', 100);
$rateLimit = config('magiclink.rate_limit', 'none');

RateLimiter::for(
'magiclink',
Expand Down

0 comments on commit 4511bb5

Please sign in to comment.