summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthewsotoudeh <matthewsot@outlook.com>2015-09-14 21:57:21 -0700
committermatthewsotoudeh <matthewsot@outlook.com>2015-09-14 21:57:21 -0700
commitb5a3f3c29e19cdc2ddda7a3ddc356603507569b1 (patch)
treec34c7d8375c8457a54113e0a265179b2ff9e497a
parent3138d840c43226da05e4fcb7cd59bd65676770a9 (diff)
still check that the password is >= 8 charsdevelop
the backend verifies this in validatorset.js, would need to change it there too
-rw-r--r--templates/lib/api.jsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/templates/lib/api.jsx b/templates/lib/api.jsx
index ce25ec2..b248991 100644
--- a/templates/lib/api.jsx
+++ b/templates/lib/api.jsx
@@ -88,6 +88,7 @@ module.exports = {
var strength = zxcvbn(password);
var tooLong = password.length > MAX_PASSWORD_LEN,
+ tooShort = password.length < MIN_PASSWORD_LEN,
strengthValid = strength.score > 2;
WebmakerActions.setPasswordStrength({ 'percent': (strength.score / 4) * 100 });
@@ -97,6 +98,9 @@ module.exports = {
if (strength.score <= 2) {
WebmakerActions.displayError({ 'field': 'password', 'message': 'Your password would only take ' + strength.crack_time_display + ' to crack. Please pick a stronger password.' });
}
+ if (tooShort) {
+ WebmakerActions.displayError({'field': 'password', 'message': 'Password must be at least 8 characters long.'});
+ }
if (tooLong) {
WebmakerActions.displayError({'field': 'password', 'message': 'Password cannot be more than 128 characters long.'});
}
@@ -108,7 +112,7 @@ module.exports = {
} else if (!username) {
WebmakerActions.displayError({'field': 'username', 'message': 'Please specify a username.'});
}
- if (strengthValid && containUserValid && !tooLong) {
+ if (strengthValid && containUserValid && !tooShort && !tooLong) {
this.setFormState({field: 'password'});
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback