Skip to content

Commit

Permalink
Drop compatibility with Redis < 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed May 24, 2024
1 parent b6fd14f commit 2b8292a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Mastodon acts as an OAuth2 provider, so 3rd party apps can use the REST and Stre
### Requirements

- **PostgreSQL** 12+
- **Redis** 4+
- **Redis** 6.2+
- **Ruby** 3.1+
- **Node.js** 18+

Expand Down
4 changes: 1 addition & 3 deletions app/controllers/auth/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ def on_authentication_failure(user, security_measure, failure_reason)
)

# Only send a notification email every hour at most
return if redis.get("2fa_failure_notification:#{user.id}").present?

redis.set("2fa_failure_notification:#{user.id}", '1', ex: 1.hour)
return if redis.set("2fa_failure_notification:#{user.id}", '1', ex: 1.hour, get: true).present?

UserMailer.failed_2fa(user, request.remote_ip, request.user_agent, Time.now.utc).deliver_later!
end
Expand Down

0 comments on commit 2b8292a

Please sign in to comment.