[% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
[% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
[% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %]
- [% IF field == "password_invalid" %]<li>Password does not meet minium requirements! <a href="#password">password</a></li>[% END %]
+ [% IF field == "password_invalid" %]<li>Password does not meet minimum requirements! <a href="#password">password</a></li>[% END %]
+ [% IF field == "password_spaces" %]<li>Password contains leading and/or trailing spaces! <a href="#password">password</a></li>[% END %]
[% END %]
</ul>
Please correct the errors and resubmit.
if ( $borrower->{'password'} && $minpw && (length($borrower->{'password'}) < $minpw) ) {
push(@invalidFields, "password_invalid");
}
+ if ( $borrower->{'password'} ) {
+ push(@invalidFields, "password_spaces") if ($borrower->{'password'} =~ /^\s/ or $borrower->{'password'} =~ /\s$/);
+ }
return \@invalidFields;
}
use Modern::Perl;
-use Test::More tests => 76;
+use Test::More tests => 77;
use Test::MockModule;
use Data::Dumper;
use C4::Context;
is( $password =~ /^[a-zA-Z]{10}$/ , 1, 'Test for autogenerated password if none submitted');
( $borrowernumber, $password ) = AddMember_Opac(surname=>"Deckard",firstname=>"Rick",password=>"Nexus-6",branchcode => $library2->{branchcode});
is( $password eq "Nexus-6", 1, 'Test password used if submitted');
+$borrower = GetMember(borrowernumber => $borrowernumber);
+my $hashed_up = Koha::AuthUtils::hash_password("Nexus-6", $borrower->{password});
+is( $borrower->{password} eq $hashed_up, 1, 'Check password hash equals hash of submitted password' );