From e99165b475d506c8871d5f7fce2be3ec5b5d6fc0 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Thu, 4 Oct 2018 10:03:21 +0100 Subject: [PATCH] Validate password length when registering --- .../app/coffee/Features/User/UserRegistrationHandler.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/User/UserRegistrationHandler.coffee b/services/web/app/coffee/Features/User/UserRegistrationHandler.coffee index 1291142dab..0928f64640 100644 --- a/services/web/app/coffee/Features/User/UserRegistrationHandler.coffee +++ b/services/web/app/coffee/Features/User/UserRegistrationHandler.coffee @@ -20,10 +20,13 @@ module.exports = UserRegistrationHandler = hasZeroLength = true return hasZeroLength + isTooShort: (prop, length) -> + return prop.length < length + _registrationRequestIsValid : (body, callback)-> email = EmailHelper.parseEmail(body.email) or '' password = body.password - if @hasZeroLengths([password, email]) + if @hasZeroLengths([password, email]) or @isTooShort(password, 6) return false else return true