Last active
July 20, 2024 17:20
-
-
Save njwest/ef076b0d740d65a1e011c8697dc9f21b to your computer and use it in GitHub Desktop.
Rate Limiter with @doc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule RateLimiter do | |
| # ...code omitted | |
| @doc """ | |
| Check the login attempt rate limit for a given email address. | |
| iex> RateLimiter.allow_login_attempt?("doctest@example.com", 1) | |
| true | |
| iex> RateLimiter.allow_login_attempt?("doctest@example.com", 0) | |
| false | |
| """ | |
| def allow_login_attempt?(email, limit \\ @email_request_limit) do | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment