enforce a configurable minimum password length when registering

This commit is contained in:
ansuz
2017-09-07 17:43:58 +02:00
parent ef30b0bc42
commit bca9ba66cb
5 changed files with 25 additions and 2 deletions

View File

@@ -7,7 +7,7 @@ define([
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/loading.less',
], function ($, Login, Cryptpad, Test) {
], function ($, Login, Cryptpad, Test, Cred) {
var Messages = Cryptpad.Messages;
$(function () {
@@ -138,7 +138,8 @@ define([
// We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password
window.setTimeout(function () {
Login.loginOrRegister(uname, passwd, true, function (err, result) {
var proxy = result.proxy;
var proxy;
if (result) { proxy = result.proxy; }
if (err) {
switch (err) {
@@ -163,6 +164,16 @@ define([
});
});
break;
case 'PASS_TOO_SHORT':
Cryptpad.removeLoadingScreen(function () {
var warning = Messages._getKey('register_passwordTooShort', [
Cred.MINIMUM_PASSWORD_LENGTH
]);
Cryptpad.alert(warning, function () {
registering = false;
});
});
break;
case 'ALREADY_REGISTERED':
// logMeIn should reset registering = false
Cryptpad.removeLoadingScreen(function () {