Bug 27148: (QA follow-up) Calculate default_strong_password correctly

Fix a typo lenght for length

If category strong password is not set, then we fall back to the preference, but that can be "" - which should be treated as 0

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3b56076405)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2020-12-21 16:06:35 +00:00 committed by Fridolin Somers
parent 33e1b3bce5
commit cfb0e9bf98
1 changed files with 3 additions and 3 deletions

View File

@ -1235,12 +1235,12 @@
var PWD_STRONG_MSG = _("Password must contain at least %s characters, including UPPERCASE, lowercase and numbers");
var PWD_WEAK_MSG = _("Password must contain at least %s characters");
var default_password_length = [% defaultCategory.effective_min_password_length | html %];
var default_strong_password = [% defaultCategory.effective_require_strong_password | html %];
var default_strong_password = [% defaultCategory.effective_require_strong_password ? defaultCategory.effective_require_strong_password : 0 | html %];
$(document).ready(function() {
var setPwdMessage = function() {
var require_strong = $('select#borrower_categorycode option:selected').length ? $('select#borrower_categorycode option:selected').data('pwdStrong') : default_strong_password;
var min_lenght = $('select#borrower_categorycode option:selected').length ? $('select#borrower_categorycode option:selected').data('pwdLength') : default_password_length;
$('#password_alert').html((require_strong?PWD_STRONG_MSG:PWD_WEAK_MSG).format(min_lenght));
var min_length = $('select#borrower_categorycode option:selected').length ? $('select#borrower_categorycode option:selected').data('pwdLength') : default_password_length;
$('#password_alert').html((require_strong?PWD_STRONG_MSG:PWD_WEAK_MSG).format(min_length));
};
setPwdMessage();
$('select#borrower_categorycode').change(setPwdMessage);