Răsfoiți Sursa

lowercase password reset email

Henry Oswald 12 ani în urmă
părinte
comite
dabed896be

+ 1 - 1
services/web/app/coffee/Features/PasswordReset/PasswordResetController.coffee

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

+ 11 - 0
services/web/test/UnitTests/coffee/PasswordReset/PasswordResetControllerTests.coffee

@@ -63,6 +63,17 @@ describe "PasswordResetController", ->
 				done()
 				done()
 			@PasswordResetController.requestReset @req, @res
 			@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", ->
 	describe "setNewUserPassword", ->
 
 
 		it "should tell the user handler to reset the password", (done)->
 		it "should tell the user handler to reset the password", (done)->