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

(-)a/C4/Auth.pm (+3 lines)
Lines 417-422 sub get_template_and_user { Link Here
417
    my $https = $in->{query}->https();
417
    my $https = $in->{query}->https();
418
    my $using_https = ( defined $https and $https ne 'OFF' ) ? 1 : 0;
418
    my $using_https = ( defined $https and $https ne 'OFF' ) ? 1 : 0;
419
419
420
    my $minPasswordLength = C4::Context->preference('minPasswordLength');
421
    $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3;
420
    $template->param(
422
    $template->param(
421
        "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
423
        "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
422
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
424
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
Lines 438-443 sub get_template_and_user { Link Here
438
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
440
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
439
        marcflavour        => C4::Context->preference("marcflavour"),
441
        marcflavour        => C4::Context->preference("marcflavour"),
440
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
442
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
443
        minPasswordLength  => $minPasswordLength,
441
    );
444
    );
442
    if ( $in->{'type'} eq "intranet" ) {
445
    if ( $in->{'type'} eq "intranet" ) {
443
        $template->param(
446
        $template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 911-917 $(document).ready(function() { Link Here
911
			[% END %]
911
			[% END %]
912
			[% END %]
912
			[% END %]
913
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
913
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
914
[% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
914
    <div class="hint">Minimum password length: [% minPasswordLength %]</div>
915
		</li>
915
		</li>
916
		<li>
916
		<li>
917
			[% IF ( mandatorypassword ) %]
917
			[% IF ( mandatorypassword ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-10 / +6 lines)
Lines 799-814 Link Here
799
                [% UNLESS action == 'edit' || hidden.defined('password') %]
799
                [% UNLESS action == 'edit' || hidden.defined('password') %]
800
                    <fieldset class="rows" id="memberentry_password">
800
                    <fieldset class="rows" id="memberentry_password">
801
                        <legend id="contact_legend">Password</legend>
801
                        <legend id="contact_legend">Password</legend>
802
                        [% IF Koha.Preference('minPasswordLength') || !mandatory.defined('password') %]
802
                        <div class="alert alert-info">
803
                            <div class="alert alert-info">
803
                            <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
804
                                [% IF Koha.Preference('minPasswordLength') %]
804
                            [% UNLESS mandatory.defined('password') %]
805
                                    <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
805
                                <div>If you do not enter a password a system generated password will be created.</div>
806
                                [% END %]
806
                            [% END %]
807
                                [% UNLESS mandatory.defined('password') %]
807
                        </div>
808
                                    <div>If you do not enter a password a system generated password will be created.</div>
809
                                [% END %]
810
                            </div>
811
                        [% END %]
812
808
813
                        [% IF mandatory.defined('password') %]
809
                        [% IF mandatory.defined('password') %]
814
                            <ol>
810
                            <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 67-72 if ( ( $member ne $loggedinuser ) && ( $category_type eq 'S' ) ) { Link Here
67
push( @errors, 'NOMATCH' ) if ( ( $newpassword && $newpassword2 ) && ( $newpassword ne $newpassword2 ) );
67
push( @errors, 'NOMATCH' ) if ( ( $newpassword && $newpassword2 ) && ( $newpassword ne $newpassword2 ) );
68
68
69
my $minpw = C4::Context->preference('minPasswordLength');
69
my $minpw = C4::Context->preference('minPasswordLength');
70
$minpw = 3 if not $minpw or $minpw < 3;
70
push( @errors, 'SHORTPASSWORD' ) if ( $newpassword && $minpw && ( length($newpassword) < $minpw ) );
71
push( @errors, 'SHORTPASSWORD' ) if ( $newpassword && $minpw && ( length($newpassword) < $minpw ) );
71
72
72
if ( $newpassword && !scalar(@errors) ) {
73
if ( $newpassword && !scalar(@errors) ) {
(-)a/members/memberentry.pl (-3 / +2 lines)
Lines 133-141 if ( $input->param('add_debarment') ) { Link Here
133
133
134
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
134
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
135
135
136
my $minpw = C4::Context->preference('minPasswordLength');
137
$template->param("minPasswordLength" => $minpw);
138
139
# function to designate mandatory fields (visually with css)
136
# function to designate mandatory fields (visually with css)
140
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
137
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
141
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
138
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
Lines 360-365 if ($op eq 'save' || $op eq 'insert'){ Link Here
360
  my $password = $input->param('password');
357
  my $password = $input->param('password');
361
  my $password2 = $input->param('password2');
358
  my $password2 = $input->param('password2');
362
  push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
359
  push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
360
  my $minpw = C4::Context->preference('minPasswordLength');
361
  $minpw = 3 if not $minpw or $minpw < 3;
363
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
362
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
364
363
365
  # Validate emails
364
  # Validate emails
(-)a/opac/opac-memberentry.pl (+1 lines)
Lines 387-392 sub CheckMandatoryFields { Link Here
387
387
388
sub CheckForInvalidFields {
388
sub CheckForInvalidFields {
389
    my $minpw = C4::Context->preference('minPasswordLength');
389
    my $minpw = C4::Context->preference('minPasswordLength');
390
    $minpw = 3 if not $minpw or $minpw < 3;
390
    my $borrower = shift;
391
    my $borrower = shift;
391
    my @invalidFields;
392
    my @invalidFields;
392
    if ($borrower->{'email'}) {
393
    if ($borrower->{'email'}) {
(-)a/opac/opac-passwd.pl (-2 / +2 lines)
Lines 47-52 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
47
47
48
my $patron = Koha::Patrons->find( $borrowernumber );
48
my $patron = Koha::Patrons->find( $borrowernumber );
49
my $minpasslen = C4::Context->preference("minPasswordLength");
49
my $minpasslen = C4::Context->preference("minPasswordLength");
50
$minpasslen = 3 if not $minpasslen or $minpasslen < 3;
50
if ( C4::Context->preference("OpacPasswordChange") ) {
51
if ( C4::Context->preference("OpacPasswordChange") ) {
51
    my $sth =  $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");
52
    my $sth =  $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");
52
    if (   $query->param('Oldkey')
53
    if (   $query->param('Oldkey')
Lines 107-114 if ( C4::Context->preference("OpacPasswordChange") ) { Link Here
107
$template->param(
108
$template->param(
108
    firstname  => $patron->firstname,
109
    firstname  => $patron->firstname,
109
    surname    => $patron->surname,
110
    surname    => $patron->surname,
110
    minpasslen => $minpasslen,
111
    passwdview => 1,
111
    passwdview => 1
112
);
112
);
113
113
114
114
(-)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 145-150 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
145
elsif ( $query->param('passwordReset') ) {
144
elsif ( $query->param('passwordReset') ) {
146
    ( $borrower_number, $username ) = GetValidLinkInfo($uniqueKey);
145
    ( $borrower_number, $username ) = GetValidLinkInfo($uniqueKey);
147
146
147
    my $minPassLength = C4::Context->preference('minPasswordLength');
148
    $minPassLength = 3 if not $minPassLength or $minPassLength < 3;
148
    #validate password length & match
149
    #validate password length & match
149
    if (   ($borrower_number)
150
    if (   ($borrower_number)
150
        && ( $password eq $repeatPassword )
151
        && ( $password eq $repeatPassword )
Lines 169-175 elsif ( $query->param('passwordReset') ) { Link Here
169
        }
170
        }
170
        $template->param(
171
        $template->param(
171
            new_password    => 1,
172
            new_password    => 1,
172
            minPassLength   => $minPassLength,
173
            email           => $email,
173
            email           => $email,
174
            uniqueKey       => $uniqueKey,
174
            uniqueKey       => $uniqueKey,
175
            errLinkNotValid => $errLinkNotValid,
175
            errLinkNotValid => $errLinkNotValid,
Lines 189-195 elsif ($uniqueKey) { #reset password form Link Here
189
189
190
    $template->param(
190
    $template->param(
191
        new_password    => 1,
191
        new_password    => 1,
192
        minPassLength   => $minPassLength,
193
        email           => $email,
192
        email           => $email,
194
        uniqueKey       => $uniqueKey,
193
        uniqueKey       => $uniqueKey,
195
        username        => $username,
194
        username        => $username,
196
- 

Return to bug 18298