View | Details | Raw Unified | Return to bug 18298
Collapse All | Expand All

(-)a/C4/Auth.pm (+3 lines)
Lines 416-421 sub get_template_and_user { Link Here
416
    my $https = $in->{query}->https();
416
    my $https = $in->{query}->https();
417
    my $using_https = ( defined $https and $https ne 'OFF' ) ? 1 : 0;
417
    my $using_https = ( defined $https and $https ne 'OFF' ) ? 1 : 0;
418
418
419
    my $minPasswordLength = C4::Context->preference('minPasswordLength');
420
    $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3;
419
    $template->param(
421
    $template->param(
420
        "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
422
        "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
421
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
423
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
Lines 437-442 sub get_template_and_user { Link Here
437
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
439
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
438
        marcflavour        => C4::Context->preference("marcflavour"),
440
        marcflavour        => C4::Context->preference("marcflavour"),
439
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
441
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
442
        minPasswordLength  => $minPasswordLength,
440
    );
443
    );
441
    if ( $in->{'type'} eq "intranet" ) {
444
    if ( $in->{'type'} eq "intranet" ) {
442
        $template->param(
445
        $template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 888-894 $(document).ready(function() { Link Here
888
			[% END %]
888
			[% END %]
889
			[% END %]
889
			[% END %]
890
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
890
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
891
[% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
891
    <div class="hint">Minimum password length: [% minPasswordLength %]</div>
892
		</li>
892
		</li>
893
		<li>
893
		<li>
894
			[% IF ( mandatorypassword ) %]
894
			[% IF ( mandatorypassword ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-9 / +5 lines)
Lines 855-870 Link Here
855
                [% UNLESS action == 'edit' || hidden.defined('password') %]
855
                [% UNLESS action == 'edit' || hidden.defined('password') %]
856
                    <fieldset class="rows" id="memberentry_password">
856
                    <fieldset class="rows" id="memberentry_password">
857
                        <legend id="contact_legend">Password</legend>
857
                        <legend id="contact_legend">Password</legend>
858
                        [% IF Koha.Preference('minPasswordLength') || !mandatory.defined('password') %]
858
                        <div class="alert alert-info">
859
                            <div class="alert alert-info">
859
                            <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
860
                                [% IF Koha.Preference('minPasswordLength') %]
860
                            [% UNLESS mandatory.defined('password') %]
861
                                    <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
861
                                If you do not enter a password a system generated password will be created.
862
                                [% END %]
862
                            [% END %]
863
                                [% UNLESS mandatory.defined('password') %]
864
                                    If you do not enter a password a system generated password will be created.
865
                                [% END %]
866
                            </div>
863
                            </div>
867
                        [% END %]
868
864
869
                        [% IF mandatory.defined('password') %]
865
                        [% IF mandatory.defined('password') %]
870
                            <ol>
866
                            <ol>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt (-2 / +2 lines)
Lines 33-39 Link Here
33
                                Passwords do not match.  Please re-type your new password.
33
                                Passwords do not match.  Please re-type your new password.
34
                                [% END %]
34
                                [% END %]
35
                                [% IF ( ShortPass ) %]
35
                                [% IF ( ShortPass ) %]
36
                                Your new password must be at least [% minpasslen %] characters long.
36
                                Your new password must be at least [% minPasswordLength%] characters long.
37
                                [% END %]
37
                                [% END %]
38
                                [% IF ( WrongPass ) %]
38
                                [% IF ( WrongPass ) %]
39
                                Your current password was entered incorrectly.  If this problem persists, please ask a librarian to reset your password for you.
39
                                Your current password was entered incorrectly.  If this problem persists, please ask a librarian to reset your password for you.
Lines 50-56 Link Here
50
50
51
                            <form action="/cgi-bin/koha/opac-passwd.pl" name="mainform" id="mainform" method="post">
51
                            <form action="/cgi-bin/koha/opac-passwd.pl" name="mainform" id="mainform" method="post">
52
                                <fieldset>
52
                                <fieldset>
53
                                    [% UNLESS ( ShortPass ) %]<div class="alert alert-info">Your password must be at least [% minpasslen %] characters long.</div>[% END %]
53
                                    [% UNLESS ( ShortPass ) %]<div class="alert alert-info">Your password must be at least [% minPasswordLength%] characters long.</div>[% END %]
54
                                    <label for="Oldkey">Current password:</label> <input type="password" id="Oldkey" size="25"  name="Oldkey" />
54
                                    <label for="Oldkey">Current password:</label> <input type="password" id="Oldkey" size="25"  name="Oldkey" />
55
                                    <label for="Newkey">New password:</label> <input type="password" id="Newkey"  size="25"  name="Newkey" />
55
                                    <label for="Newkey">New password:</label> <input type="password" id="Newkey"  size="25"  name="Newkey" />
56
                                    <label for="Confirm">Re-type new password:</label> <input type="password"  id="Confirm" size="25" name="Confirm" />
56
                                    <label for="Confirm">Re-type new password:</label> <input type="password"  id="Confirm" size="25" name="Confirm" />
(-)a/members/member-password.pl (+1 lines)
Lines 60-65 if ( ( $member ne $loggedinuser ) && ( $bor->{'category_type'} eq 'S' ) ) { Link Here
60
push( @errors, 'NOMATCH' ) if ( ( $newpassword && $newpassword2 ) && ( $newpassword ne $newpassword2 ) );
60
push( @errors, 'NOMATCH' ) if ( ( $newpassword && $newpassword2 ) && ( $newpassword ne $newpassword2 ) );
61
61
62
my $minpw = C4::Context->preference('minPasswordLength');
62
my $minpw = C4::Context->preference('minPasswordLength');
63
$minpw = 3 if not $minpw or $minpw < 3;
63
push( @errors, 'SHORTPASSWORD' ) if ( $newpassword && $minpw && ( length($newpassword) < $minpw ) );
64
push( @errors, 'SHORTPASSWORD' ) if ( $newpassword && $minpw && ( length($newpassword) < $minpw ) );
64
65
65
if ( $newpassword && !scalar(@errors) ) {
66
if ( $newpassword && !scalar(@errors) ) {
(-)a/members/memberentry.pl (-3 / +2 lines)
Lines 132-140 if ( $input->param('add_debarment') ) { Link Here
132
132
133
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
133
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
134
134
135
my $minpw = C4::Context->preference('minPasswordLength');
136
$template->param("minPasswordLength" => $minpw);
137
138
# function to designate mandatory fields (visually with css)
135
# function to designate mandatory fields (visually with css)
139
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
136
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
140
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
137
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
Lines 347-352 if ($op eq 'save' || $op eq 'insert'){ Link Here
347
  my $password = $input->param('password');
344
  my $password = $input->param('password');
348
  my $password2 = $input->param('password2');
345
  my $password2 = $input->param('password2');
349
  push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
346
  push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
347
  my $minpw = C4::Context->preference('minPasswordLength');
348
  $minpw = 3 if not $minpw or $minpw < 3;
350
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
349
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
351
350
352
  # Validate emails
351
  # Validate emails
(-)a/opac/opac-memberentry.pl (+1 lines)
Lines 385-390 sub CheckMandatoryFields { Link Here
385
385
386
sub CheckForInvalidFields {
386
sub CheckForInvalidFields {
387
    my $minpw = C4::Context->preference('minPasswordLength');
387
    my $minpw = C4::Context->preference('minPasswordLength');
388
    $minpw = 3 if not $minpw or $minpw < 3;
388
    my $borrower = shift;
389
    my $borrower = shift;
389
    my @invalidFields;
390
    my @invalidFields;
390
    if ($borrower->{'email'}) {
391
    if ($borrower->{'email'}) {
(-)a/opac/opac-passwd.pl (-1 / +1 lines)
Lines 46-51 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
46
46
47
my $borr = C4::Members::GetMember( borrowernumber => $borrowernumber );
47
my $borr = C4::Members::GetMember( borrowernumber => $borrowernumber );
48
my $minpasslen = C4::Context->preference("minPasswordLength");
48
my $minpasslen = C4::Context->preference("minPasswordLength");
49
$minpasslen = 3 if not $minpasslen or $minpasslen < 3;
49
if ( C4::Context->preference("OpacPasswordChange") ) {
50
if ( C4::Context->preference("OpacPasswordChange") ) {
50
    my $sth =  $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");
51
    my $sth =  $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");
51
    if (   $query->param('Oldkey')
52
    if (   $query->param('Oldkey')
Lines 105-111 if ( C4::Context->preference("OpacPasswordChange") ) { Link Here
105
}
106
}
106
$template->param(firstname => $borr->{'firstname'},
107
$template->param(firstname => $borr->{'firstname'},
107
							surname => $borr->{'surname'},
108
							surname => $borr->{'surname'},
108
							minpasslen => $minpasslen,
109
							passwdview => 1,
109
							passwdview => 1,
110
);
110
);
111
111
(-)a/opac/opac-password-recovery.pl (-4 / +2 lines)
Lines 28-34 my ( $template, $dummy, $cookie ) = get_template_and_user( Link Here
28
my $email          = $query->param('email') // q{};
28
my $email          = $query->param('email') // q{};
29
my $password       = $query->param('password');
29
my $password       = $query->param('password');
30
my $repeatPassword = $query->param('repeatPassword');
30
my $repeatPassword = $query->param('repeatPassword');
31
my $minPassLength  = C4::Context->preference('minPasswordLength');
32
my $id             = $query->param('id');
31
my $id             = $query->param('id');
33
my $uniqueKey      = $query->param('uniqueKey');
32
my $uniqueKey      = $query->param('uniqueKey');
34
my $username       = $query->param('username');
33
my $username       = $query->param('username');
Lines 133-138 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
133
elsif ( $query->param('passwordReset') ) {
132
elsif ( $query->param('passwordReset') ) {
134
    ( $borrower_number, $username ) = GetValidLinkInfo($uniqueKey);
133
    ( $borrower_number, $username ) = GetValidLinkInfo($uniqueKey);
135
134
135
    my $minPassLength = C4::Context->preference('minPasswordLength');
136
    $minPassLength = 3 if not $minPassLength or $minPassLength < 3;
136
    #validate password length & match
137
    #validate password length & match
137
    if (   ($borrower_number)
138
    if (   ($borrower_number)
138
        && ( $password eq $repeatPassword )
139
        && ( $password eq $repeatPassword )
Lines 157-163 elsif ( $query->param('passwordReset') ) { Link Here
157
        }
158
        }
158
        $template->param(
159
        $template->param(
159
            new_password    => 1,
160
            new_password    => 1,
160
            minPassLength   => $minPassLength,
161
            email           => $email,
161
            email           => $email,
162
            uniqueKey       => $uniqueKey,
162
            uniqueKey       => $uniqueKey,
163
            errLinkNotValid => $errLinkNotValid,
163
            errLinkNotValid => $errLinkNotValid,
Lines 177-183 elsif ($uniqueKey) { #reset password form Link Here
177
177
178
    $template->param(
178
    $template->param(
179
        new_password    => 1,
179
        new_password    => 1,
180
        minPassLength   => $minPassLength,
181
        email           => $email,
180
        email           => $email,
182
        uniqueKey       => $uniqueKey,
181
        uniqueKey       => $uniqueKey,
183
        username        => $username,
182
        username        => $username,
184
- 

Return to bug 18298