Преглед изворни кода

Validate password length when registering

Alasdair Smith пре 8 година
родитељ
комит
e99165b475
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      services/web/app/coffee/Features/User/UserRegistrationHandler.coffee

+ 4 - 1
services/web/app/coffee/Features/User/UserRegistrationHandler.coffee

@@ -20,10 +20,13 @@ module.exports = UserRegistrationHandler =
 				hasZeroLength = true
 				hasZeroLength = true
 		return hasZeroLength
 		return hasZeroLength
 
 
+	isTooShort: (prop, length) ->
+		return prop.length < length
+
 	_registrationRequestIsValid : (body, callback)->
 	_registrationRequestIsValid : (body, callback)->
 		email = EmailHelper.parseEmail(body.email) or ''
 		email = EmailHelper.parseEmail(body.email) or ''
 		password = body.password
 		password = body.password
-		if @hasZeroLengths([password, email])
+		if @hasZeroLengths([password, email]) or @isTooShort(password, 6)
 			return false
 			return false
 		else
 		else
 			return true
 			return true