Просмотр исходного кода

changing email address should lowercase the email

Henry Oswald 12 лет назад
Родитель
Сommit
7964616f02

+ 1 - 1
services/web/app/coffee/Features/User/UserController.coffee

@@ -54,7 +54,7 @@ module.exports =
 			if req.body.pdfViewer?
 			if req.body.pdfViewer?
 				user.ace.pdfViewer = req.body.pdfViewer
 				user.ace.pdfViewer = req.body.pdfViewer
 			user.save (err)->
 			user.save (err)->
-				newEmail = req.body.email?.trim()
+				newEmail = req.body.email?.trim().toLowerCase()
 				if !newEmail? or newEmail == user.email
 				if !newEmail? or newEmail == user.email
 					return res.send 200
 					return res.send 200
 				else if newEmail.indexOf("@") == -1
 				else if newEmail.indexOf("@") == -1

+ 1 - 1
services/web/test/UnitTests/coffee/User/UserControllerTests.coffee

@@ -134,7 +134,7 @@ describe "UserController", ->
 			@UserController.updateUserSettings @req, @res
 			@UserController.updateUserSettings @req, @res
 
 
 		it "should call the user updater with the new email and user _id", (done)->
 		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)
 			@UserUpdater.changeEmailAddress.callsArgWith(2)
 			@res.send = (code)=>
 			@res.send = (code)=>
 				code.should.equal 200
 				code.should.equal 200