From 7964616f02f87b1aeba3e5dbcd488b826c92836c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 13 Oct 2014 15:44:45 +0100 Subject: [PATCH] changing email address should lowercase the email --- services/web/app/coffee/Features/User/UserController.coffee | 2 +- .../web/test/UnitTests/coffee/User/UserControllerTests.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/Features/User/UserController.coffee b/services/web/app/coffee/Features/User/UserController.coffee index ba41904812..1515fc86f0 100644 --- a/services/web/app/coffee/Features/User/UserController.coffee +++ b/services/web/app/coffee/Features/User/UserController.coffee @@ -54,7 +54,7 @@ module.exports = if req.body.pdfViewer? user.ace.pdfViewer = req.body.pdfViewer user.save (err)-> - newEmail = req.body.email?.trim() + newEmail = req.body.email?.trim().toLowerCase() if !newEmail? or newEmail == user.email return res.send 200 else if newEmail.indexOf("@") == -1 diff --git a/services/web/test/UnitTests/coffee/User/UserControllerTests.coffee b/services/web/test/UnitTests/coffee/User/UserControllerTests.coffee index 4612a77e0d..ec3fde5b3e 100644 --- a/services/web/test/UnitTests/coffee/User/UserControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/User/UserControllerTests.coffee @@ -134,7 +134,7 @@ describe "UserController", -> @UserController.updateUserSettings @req, @res it "should call the user updater with the new email and user _id", (done)-> - @req.body.email = @newEmail + @req.body.email = @newEmail.toUpperCase() @UserUpdater.changeEmailAddress.callsArgWith(2) @res.send = (code)=> code.should.equal 200