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

(-)a/C4/Auth.pm (+3 lines)
Lines 413-418 sub get_template_and_user { Link Here
413
    my $https = $in->{query}->https();
413
    my $https = $in->{query}->https();
414
    my $using_https = ( defined $https and $https ne 'OFF' ) ? 1 : 0;
414
    my $using_https = ( defined $https and $https ne 'OFF' ) ? 1 : 0;
415
415
416
    my $minPasswordLength = C4::Context->preference('minPasswordLength');
417
    $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3;
416
    $template->param(
418
    $template->param(
417
        "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
419
        "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
418
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
420
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
Lines 434-439 sub get_template_and_user { Link Here
434
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
436
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
435
        marcflavour        => C4::Context->preference("marcflavour"),
437
        marcflavour        => C4::Context->preference("marcflavour"),
436
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
438
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
439
        minPasswordLength  => $minPasswordLength,
437
    );
440
    );
438
    if ( $in->{'type'} eq "intranet" ) {
441
    if ( $in->{'type'} eq "intranet" ) {
439
        $template->param(
442
        $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 850-865 Link Here
850
                [% UNLESS action == 'edit' || hidden.defined('password') %]
850
                [% UNLESS action == 'edit' || hidden.defined('password') %]
851
                    <fieldset class="rows" id="memberentry_password">
851
                    <fieldset class="rows" id="memberentry_password">
852
                        <legend id="contact_legend">Password</legend>
852
                        <legend id="contact_legend">Password</legend>
853
                        [% IF Koha.Preference('minPasswordLength') || !mandatory.defined('password') %]
853
                        <div class="alert alert-info">
854
                            <div class="alert alert-info">
854
                            <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
855
                                [% IF Koha.Preference('minPasswordLength') %]
855
                            [% UNLESS mandatory.defined('password') %]
856
                                    <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
856
                                If you do not enter a password a system generated password will be created.
857
                                [% END %]
857
                            [% END %]
858
                                [% UNLESS mandatory.defined('password') %]
859
                                    If you do not enter a password a system generated password will be created.
860
                                [% END %]
861
                            </div>
858
                            </div>
862
                        [% END %]
863
859
864
                        [% IF mandatory.defined('password') %]
860
                        [% IF mandatory.defined('password') %]
865
                            <ol>
861
                            <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 / +1 lines)
Lines 63-68 if ( ( $member ne $loggedinuser ) && ( $bor->{'category_type'} eq 'S' ) ) { Link Here
63
push( @errors, 'NOMATCH' ) if ( ( $newpassword && $newpassword2 ) && ( $newpassword ne $newpassword2 ) );
63
push( @errors, 'NOMATCH' ) if ( ( $newpassword && $newpassword2 ) && ( $newpassword ne $newpassword2 ) );
64
64
65
my $minpw = C4::Context->preference('minPasswordLength');
65
my $minpw = C4::Context->preference('minPasswordLength');
66
$minpw = 3 if not $minpw or $minpw < 3;
66
push( @errors, 'SHORTPASSWORD' ) if ( $newpassword && $minpw && ( length($newpassword) < $minpw ) );
67
push( @errors, 'SHORTPASSWORD' ) if ( $newpassword && $minpw && ( length($newpassword) < $minpw ) );
67
68
68
if ( $newpassword && !scalar(@errors) ) {
69
if ( $newpassword && !scalar(@errors) ) {
Lines 136-142 $template->param( Link Here
136
    destination                => $destination,
137
    destination                => $destination,
137
    is_child                   => ( $bor->{'category_type'} eq 'C' ),
138
    is_child                   => ( $bor->{'category_type'} eq 'C' ),
138
    activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ),
139
    activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ),
139
    minPasswordLength          => $minpw,
140
    RoutingSerials             => C4::Context->preference('RoutingSerials'),
140
    RoutingSerials             => C4::Context->preference('RoutingSerials'),
141
    csrf_token                 => Koha::Token->new->generate_csrf({
141
    csrf_token                 => Koha::Token->new->generate_csrf({
142
        id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
142
        id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
(-)a/members/memberentry.pl (-3 / +2 lines)
Lines 134-142 if ( $input->param('add_debarment') ) { Link Here
134
134
135
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
135
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
136
136
137
my $minpw = C4::Context->preference('minPasswordLength');
138
$template->param("minPasswordLength" => $minpw);
139
140
# function to designate mandatory fields (visually with css)
137
# function to designate mandatory fields (visually with css)
141
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
138
my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
142
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
139
my @field_check=split(/\|/,$check_BorrowerMandatoryField);
Lines 350-355 if ($op eq 'save' || $op eq 'insert'){ Link Here
350
  my $password = $input->param('password');
347
  my $password = $input->param('password');
351
  my $password2 = $input->param('password2');
348
  my $password2 = $input->param('password2');
352
  push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
349
  push @errors, "ERROR_password_mismatch" if ( $password ne $password2 );
350
  my $minpw = C4::Context->preference('minPasswordLength');
351
  $minpw = 3 if not $minpw or $minpw < 3;
353
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
352
  push @errors, "ERROR_short_password" if( $password && $minpw && $password ne '****' && (length($password) < $minpw) );
354
353
355
  # Validate emails
354
  # Validate emails
(-)a/opac/opac-memberentry.pl (+1 lines)
Lines 366-371 sub CheckMandatoryFields { Link Here
366
366
367
sub CheckForInvalidFields {
367
sub CheckForInvalidFields {
368
    my $minpw = C4::Context->preference('minPasswordLength');
368
    my $minpw = C4::Context->preference('minPasswordLength');
369
    $minpw = 3 if not $minpw or $minpw < 3;
369
    my $borrower = shift;
370
    my $borrower = shift;
370
    my @invalidFields;
371
    my @invalidFields;
371
    if ($borrower->{'email'}) {
372
    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