my $https = $in->{query}->https();
my $using_https = ( defined $https and $https ne 'OFF' ) ? 1 : 0;
+ my $minPasswordLength = C4::Context->preference('minPasswordLength');
+ $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3;
$template->param(
"BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'),
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
marcflavour => C4::Context->preference("marcflavour"),
OPACBaseURL => C4::Context->preference('OPACBaseURL'),
+ minPasswordLength => $minPasswordLength,
);
if ( $in->{'type'} eq "intranet" ) {
$template->param(
[% END %]
[% END %]
[% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
-[% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
+ <div class="hint">Minimum password length: [% minPasswordLength %]</div>
</li>
<li>
[% IF ( mandatorypassword ) %]
[% UNLESS action == 'edit' || hidden.defined('password') %]
<fieldset class="rows" id="memberentry_password">
<legend id="contact_legend">Password</legend>
- [% IF Koha.Preference('minPasswordLength') || !mandatory.defined('password') %]
- <div class="alert alert-info">
- [% IF Koha.Preference('minPasswordLength') %]
- <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
- [% END %]
- [% UNLESS mandatory.defined('password') %]
- <div>If you do not enter a password a system generated password will be created.</div>
- [% END %]
- </div>
- [% END %]
+ <div class="alert alert-info">
+ <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
+ [% UNLESS mandatory.defined('password') %]
+ <div>If you do not enter a password a system generated password will be created.</div>
+ [% END %]
+ </div>
[% IF mandatory.defined('password') %]
<ol>
Passwords do not match. Please re-type your new password.
[% END %]
[% IF ( ShortPass ) %]
- Your new password must be at least [% minpasslen %] characters long.
+ Your new password must be at least [% minPasswordLength%] characters long.
[% END %]
[% IF ( WrongPass ) %]
Your current password was entered incorrectly. If this problem persists, please ask a librarian to reset your password for you.
<form action="/cgi-bin/koha/opac-passwd.pl" name="mainform" id="mainform" method="post">
<fieldset>
- [% UNLESS ( ShortPass ) %]<div class="alert alert-info">Your password must be at least [% minpasslen %] characters long.</div>[% END %]
+ [% UNLESS ( ShortPass ) %]<div class="alert alert-info">Your password must be at least [% minPasswordLength%] characters long.</div>[% END %]
<label for="Oldkey">Current password:</label> <input type="password" id="Oldkey" size="25" name="Oldkey" />
<label for="Newkey">New password:</label> <input type="password" id="Newkey" size="25" name="Newkey" />
<label for="Confirm">Re-type new password:</label> <input type="password" id="Confirm" size="25" name="Confirm" />
push( @errors, 'NOMATCH' ) if ( ( $newpassword && $newpassword2 ) && ( $newpassword ne $newpassword2 ) );
my $minpw = C4::Context->preference('minPasswordLength');
+$minpw = 3 if not $minpw or $minpw < 3;
push( @errors, 'SHORTPASSWORD' ) if ( $newpassword && $minpw && ( length($newpassword) < $minpw ) );
if ( $newpassword && !scalar(@errors) ) {
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
-my $minpw = C4::Context->preference('minPasswordLength');
-$template->param("minPasswordLength" => $minpw);
-
# function to designate mandatory fields (visually with css)
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
my $password = $input->param('password');
my $password2 = $input->param('password2');
push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
+ my $minpw = C4::Context->preference('minPasswordLength');
+ $minpw = 3 if not $minpw or $minpw < 3;
push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
# Validate emails
sub CheckForInvalidFields {
my $minpw = C4::Context->preference('minPasswordLength');
+ $minpw = 3 if not $minpw or $minpw < 3;
my $borrower = shift;
my @invalidFields;
if ($borrower->{'email'}) {
my $patron = Koha::Patrons->find( $borrowernumber );
my $minpasslen = C4::Context->preference("minPasswordLength");
+$minpasslen = 3 if not $minpasslen or $minpasslen < 3;
if ( C4::Context->preference("OpacPasswordChange") ) {
my $sth = $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");
if ( $query->param('Oldkey')
$template->param(
firstname => $patron->firstname,
surname => $patron->surname,
- minpasslen => $minpasslen,
- passwdview => 1
+ passwdview => 1,
);
my $email = $query->param('email') // q{};
my $password = $query->param('password');
my $repeatPassword = $query->param('repeatPassword');
-my $minPassLength = C4::Context->preference('minPasswordLength');
my $id = $query->param('id');
my $uniqueKey = $query->param('uniqueKey');
my $username = $query->param('username');
elsif ( $query->param('passwordReset') ) {
( $borrower_number, $username ) = GetValidLinkInfo($uniqueKey);
+ my $minPassLength = C4::Context->preference('minPasswordLength');
+ $minPassLength = 3 if not $minPassLength or $minPassLength < 3;
#validate password length & match
if ( ($borrower_number)
&& ( $password eq $repeatPassword )
}
$template->param(
new_password => 1,
- minPassLength => $minPassLength,
email => $email,
uniqueKey => $uniqueKey,
errLinkNotValid => $errLinkNotValid,
$template->param(
new_password => 1,
- minPassLength => $minPassLength,
email => $email,
uniqueKey => $uniqueKey,
username => $username,