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