-
Notifications
You must be signed in to change notification settings - Fork 24
feat(unblock): add unblock rate limits #131
Conversation
} | ||
|
||
EmailRecord.parse = function (object) { | ||
var rec = new EmailRecord() | ||
object = object || {} | ||
rec.bk = object.bk // timestamp when the account was banned | ||
rec.rl = object.rl // timestamp when the account was rate-limited | ||
rec.xs = object.xs || [] // timestamps when emails were sent | ||
rec.xs = object.xs || rec.xs // timestamps when emails were sent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this fix a bug, or just for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that an Array is already initialized in the constructor, why create a new one. One might hope that V8 can initialize arrays for nothing, but 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 ; mostly just confirming it wasn't a bug :-)
@seanmonstar as an unsolicited f?, this LGTM at a high-level - it's more ad-hoc coupling between auth-server and customs-server APIs, but we're well down that road already, so 👍 |
7ae38b6
to
31a6e86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM apart from test coverage of the payload stuff.
return { | ||
block: true, | ||
retryAfter: ipRecord.retryAfter() | ||
} | ||
} | ||
|
||
|
||
var blockEmail = emailRecord.update(action) | ||
var wantsUnblock = req.body.payload && req.body.payload.unblockCode | ||
var blockEmail = emailRecord.update(action, !!wantsUnblock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be worth adding a remote test exercises this payload-checking logic
351f72a
to
48664c4
Compare
@rfk added a remote test that |
cc mozilla/fxa-auth-server#1471