warn that a password is too short before doing anything else

This commit is contained in:
ansuz 2017-09-12 10:50:59 +02:00
parent a0b3201df3
commit 499b5ea2ba
1 changed files with 9 additions and 0 deletions

View File

@ -115,6 +115,15 @@ define([
var doesAccept = $checkAcceptTerms[0].checked;
/* basic validation */
if (!Cred.isLongEnoughPassword(passwd)) {
var warning = Messages._getKey('register_passwordTooShort', [
Cred.MINIMUM_PASSWORD_LENGTH
]);
return void Cryptpad.alert(warning, function () {
registering = false;
});
}
if (passwd !== confirmPassword) { // do their passwords match?
return void Cryptpad.alert(Messages.register_passwordsDontMatch);
}