aboutsummaryrefslogtreecommitdiffstats
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/config.js-example10
-rw-r--r--www/js/strings.en.js5
-rw-r--r--www/js/strings.es.js5
-rw-r--r--www/js/views/login.js2
-rw-r--r--www/js/views/submit.js7
5 files changed, 24 insertions, 5 deletions
diff --git a/www/js/config.js-example b/www/js/config.js-example
index 6be0250..66e0ed8 100644
--- a/www/js/config.js-example
+++ b/www/js/config.js-example
@@ -69,7 +69,15 @@ var CONFIG = {
// If the user is logged in and this setting is true, the 'Your details'
// page is skipped and the report is sent immediately after the report
// details have been entered.
- SKIP_CONFIRM_REPORT: false
+ SKIP_CONFIRM_REPORT: false,
+
+ // You can optionally enforce a minimum password length if the user is
+ // registering an account when submitting a report. This should match the
+ // same minimum length required by your FixMyStreet server.
+ // Set this to 0 if you wish to disable this check. NB: If the check is
+ // active on the server the user's password may still be rejected if it's
+ // too short.
+ PASSWORD_MIN_LENGTH: 6
};
diff --git a/www/js/strings.en.js b/www/js/strings.en.js
index 1dabd30..bf67b14 100644
--- a/www/js/strings.en.js
+++ b/www/js/strings.en.js
@@ -17,7 +17,10 @@
required: 'Please enter your email',
email: 'Please enter a valid email'
},
- password: 'Please enter a password'
+ password: {
+ required: 'Please enter a password',
+ short: 'Please enter a password at least %d characters long'
+ }
},
strings: {
next: 'Next',
diff --git a/www/js/strings.es.js b/www/js/strings.es.js
index 9c8b950..5b2481b 100644
--- a/www/js/strings.es.js
+++ b/www/js/strings.es.js
@@ -17,7 +17,10 @@
required: 'Por favor, introduzca su email',
email: 'Por favor, introduzca un email válido'
},
- password: 'Por favor, introduzca la contraseña'
+ password: {
+ required: 'Por favor, introduzca la contraseña',
+ short: 'Please enter a password at least %d characters long'
+ }
},
strings: {
next: 'Siguiente',
diff --git a/www/js/views/login.js b/www/js/views/login.js
index 93a9a5b..9225c18 100644
--- a/www/js/views/login.js
+++ b/www/js/views/login.js
@@ -78,7 +78,7 @@
if ( !$('#form_password').val() ) {
isValid = 0;
- this.validationError('form_password', FMS.validationStrings.password );
+ this.validationError('form_password', FMS.validationStrings.password.required);
}
var email = $('#form_email').val();
diff --git a/www/js/views/submit.js b/www/js/views/submit.js
index f24f21c..99f2d9b 100644
--- a/www/js/views/submit.js
+++ b/www/js/views/submit.js
@@ -340,11 +340,16 @@
},
validate: function() {
+ this.clearValidationErrors();
var isValid = 1;
if ( !$('#form_password').val() ) {
isValid = 0;
- this.validationError('form_password', FMS.validationStrings.password );
+ this.validationError('form_password', FMS.validationStrings.password.required );
+ } else if ( CONFIG.PASSWORD_MIN_LENGTH && $('#form_password').val().length < CONFIG.PASSWORD_MIN_LENGTH ) {
+ isValid = 0;
+ var msg = FMS.validationStrings.password.short.replace('%d', CONFIG.PASSWORD_MIN_LENGTH);
+ this.validationError('form_password', msg);
}
if ($('#form_name').val() && !this.validateUserTitle()) {