From dabed896be9b3400b4f47b50ab8dd67c42cbb0b6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 10 Jun 2014 17:54:29 +0100 Subject: [PATCH] lowercase password reset email --- .../PasswordReset/PasswordResetController.coffee | 2 +- .../PasswordReset/PasswordResetControllerTests.coffee | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee index 3acf680952..6874cbe43d 100644 --- a/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee +++ b/services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee @@ -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 diff --git a/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee b/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee index 4dc3af38dc..187719dcd3 100644 --- a/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee @@ -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)->