changing email address should lowercase the email

This commit is contained in:
Henry Oswald 2014-10-13 15:44:45 +01:00
parent 36264706f6
commit 7964616f02
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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