lowercase password reset email

This commit is contained in:
Henry Oswald 2014-06-10 17:54:29 +01:00
parent 521befddd3
commit dabed896be
2 changed files with 12 additions and 1 deletions

View file

@ -9,7 +9,7 @@ module.exports =
title:"Reset Password"
requestReset: (req, res)->
email = req.body.email.trim()
email = req.body.email.trim().toLowerCase()
opts =
endpointName:"auto_compile"
timeInterval:60

View file

@ -63,6 +63,17 @@ describe "PasswordResetController", ->
done()
@PasswordResetController.requestReset @req, @res
it "should lowercase the email address", (done)->
@email = "UPerCaseEMAIL@example.Com"
@req.body.email = @email
@RateLimiter.addCount.callsArgWith(1, null, true)
@PasswordResetHandler.generateAndEmailResetToken.callsArgWith(1)
@res.send = (code)=>
code.should.equal 200
@PasswordResetHandler.generateAndEmailResetToken.calledWith(@email.toLowerCase()).should.equal true
done()
@PasswordResetController.requestReset @req, @res
describe "setNewUserPassword", ->
it "should tell the user handler to reset the password", (done)->