Created
July 20, 2024 19:23
-
-
Save njwest/11fbeef568ba66b261e5f44937619bef to your computer and use it in GitHub Desktop.
This file contains 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
# ...code omitted | |
require Logger | |
# ...code omitted | |
def allow_login_attempt?(email, limit \\ @login_request_limit) do | |
case ExRated.check_rate("login_attempt:#{email}", @time_window, limit) do | |
{:ok, _count} -> true | |
{:error, _limit} -> | |
Logger.warning("Login attempt limit exceeded for email: #{email}") | |
false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment