From 1864c641e6006568e35645549593e761bbc68f93 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Fri, 24 Nov 2017 11:42:25 +1300 Subject: [PATCH] Bug 18308: Added warning and dialog alert If an institution has a minPasswordLength which is < 8 characters then a warning will be set (which is visible in the intranet-error.log) and a dialog alert div will display the warning to the user in the memberentry.pl page in the intranet. Test plan: 1. Ensure that your minPasswordLength is set to less than 8 characters. This replicates the use case that a Koha instance is existing (i.e. not a new Koha instance) and not gone through the password length step of the onboarding tool (previous patch on this bug report) or that the institituion is new but set a password length of less than 8 in the onboarding tool 2. Go to the memberentry.pl page and notice that there is no warning at the top of the page informing you that your minPasswordLength is less than 8 3. Apply this patch 4. Refresh the memberentry.pl page and notice that there is a yellow warning at the top of the page informing you that your minPasswordLength syspref is less than 8 Sponsored-By: Catalyst IT Signed-off-by: Dominic Pichette Signed-off-by: David Bourgault Signed-off-by: Liz Rea --- .../intranet-tmpl/prog/en/modules/members/memberentrygen.tt | 5 +++++ .../prog/en/modules/onboarding/onboardingstep6.tt | 3 ++- members/memberentry.pl | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 52a6913185..e1ef3d5e39 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -131,6 +131,11 @@ [% END %] +[% IF passwordwarning %] +
+

Warning: [% passwordwarning %]

+
+[% END %]
[% UNLESS ( check_member ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt index f02435646f..f88dbaa6fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt @@ -23,11 +23,12 @@

Congratulations you have finished and are ready to use Koha

Start using Koha [% ELSE %] +

Web installer › Set minPasswordLength system preference

+ [% INCLUDE 'onboarding_messages.inc' %] The minPasswordLength system preference is a setting for the shortest length library staff and patrons can set their passwords to. -
diff --git a/members/memberentry.pl b/members/memberentry.pl index b7a3920342..d15120d41f 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -171,6 +171,14 @@ $category_type="A" unless $category_type; # FIXME we should display a error mess # if a add or modify is requested => check validity of data. %data = %$borrower_data if ($borrower_data); +#Check passwords +my $minPasswordLength = C4::Context->preference('minPasswordLength'); +warn $minPasswordLength; +if ($minPasswordLength < 8) { + warn my $warning = "Your minPasswordLength system preference is less than 8 characters this means library patrons can potentially set passwords which are vulnerable to cracking. Please set your minPasswordLength syspref to 8 or more characters"; + $template->param("passwordwarning"=>$warning); +} + # initialize %newdata my %newdata; # comes from $input->param() if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) { @@ -365,6 +373,8 @@ if ($op eq 'save' || $op eq 'insert'){ push @errors, "ERROR_login_exist"; } + + my $password = $input->param('password'); my $password2 = $input->param('password2'); push @errors, "ERROR_password_mismatch" if ( $password ne $password2 ); -- 2.11.0