2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FIX: rate limit password reset email

This commit is contained in:
Sam 2014-08-18 10:55:30 +10:00
parent 582ec5954f
commit e0a82d3088
5 changed files with 38 additions and 14 deletions

View file

@ -19,7 +19,7 @@ class RateLimiter
def initialize(user, key, max, secs)
@user = user
@key = "l-rate-limit:#{@user.id}:#{key}"
@key = "l-rate-limit:#{@user && @user.id}:#{key}"
@max = max
@secs = secs
end
@ -71,6 +71,6 @@ class RateLimiter
end
def rate_unlimited?
!!(RateLimiter.disabled? || @user.staff?)
!!(RateLimiter.disabled? || (@user && @user.staff?))
end
end