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

(-)a/admin/categories.pl (-3 / +5 lines)
Lines 92-100 elsif ( $op eq 'add_validate' ) { Link Here
92
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
92
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
93
    my $checkPrevCheckout = $input->param('checkprevcheckout');
93
    my $checkPrevCheckout = $input->param('checkprevcheckout');
94
    my $default_privacy = $input->param('default_privacy');
94
    my $default_privacy = $input->param('default_privacy');
95
    my $can_reset_password = $input->param('can_reset_password');
95
    my $reset_password = $input->param('reset_password');
96
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
96
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
97
97
98
    $reset_password = undef if $reset_password eq -1;
99
98
    my $is_a_modif = $input->param("is_a_modif");
100
    my $is_a_modif = $input->param("is_a_modif");
99
101
100
    if ($enrolmentperioddate) {
102
    if ($enrolmentperioddate) {
Lines 123-129 elsif ( $op eq 'add_validate' ) { Link Here
123
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
125
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
124
        $category->checkprevcheckout($checkPrevCheckout);
126
        $category->checkprevcheckout($checkPrevCheckout);
125
        $category->default_privacy($default_privacy);
127
        $category->default_privacy($default_privacy);
126
        $category->can_reset_password($can_reset_password);
128
        $category->reset_password($reset_password);
127
        eval {
129
        eval {
128
            $category->store;
130
            $category->store;
129
            $category->replace_branch_limitations( \@branches );
131
            $category->replace_branch_limitations( \@branches );
Lines 150-156 elsif ( $op eq 'add_validate' ) { Link Here
150
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
152
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
151
            checkprevcheckout => $checkPrevCheckout,
153
            checkprevcheckout => $checkPrevCheckout,
152
            default_privacy => $default_privacy,
154
            default_privacy => $default_privacy,
153
            can_reset_password => $can_reset_password,
155
            reset_password => $reset_password,
154
        });
156
        });
155
        eval {
157
        eval {
156
            $category->store;
158
            $category->store;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (-7 / +27 lines)
Lines 166-180 Link Here
166
                    </span>
166
                    </span>
167
                </li>
167
                </li>
168
                <li>
168
                <li>
169
                    <label for="can_reset_password">Password reset in OPAC: </label>
169
                    <label for="reset_password">Password reset in OPAC: </label>
170
                    <select name="can_reset_password" id="can_reset_password">
170
                    <select name="reset_password" id="reset_password">
171
                        [% IF category.can_reset_password %]
171
                      [% IF category.reset_password.defined %]
172
                            <option value="0">Allowed</option>
172
                        [% IF category.reset_password %]
173
                            <option value="1" selected="selected">Not allowed</option>
173
                          [% IF Koha.Preference('OpacResetPassword') %]
174
                            <option value="-1">Follow system preference OpacResetPassword (enabled)</option>
175
                          [% ELSE %]
176
                            <option value="-1">Follow system preference OpacResetPassword (disabled)</option>
177
                          [% END %]
178
                            <option value="1" selected="selected">Allowed</option>
179
                            <option value="0">Not allowed</option>
174
                        [% ELSE %]
180
                        [% ELSE %]
175
                            <option value="0" selected="selected">Allowed</option>
181
                          [% IF Koha.Preference('OpacResetPassword') %]
176
                            <option value="1">Not allowed</option>
182
                            <option value="-1">Follow system preference OpacResetPassword (enabled)</option>
183
                          [% ELSE %]
184
                            <option value="-1">Follow system preference OpacResetPassword (disabled)</option>
185
                          [% END %]
186
                            <option value="1">Allowed</option>
187
                            <option value="0" selected="selected">Not allowed</option>
177
                        [% END %]
188
                        [% END %]
189
                      [% ELSE %]
190
                          [% IF Koha.Preference('OpacResetPassword') %]
191
                            <option value="-1" selected="selected">Follow system preference OpacResetPassword (enabled)</option>
192
                          [% ELSE %]
193
                            <option value="-1" selected="selected">Follow system preference OpacResetPassword (disabled)</option>
194
                          [% END %]
195
                            <option value="1">Allowed</option>
196
                            <option value="0">Not allowed</option>
197
                      [% END %]
178
                    </select>
198
                    </select>
179
                </li>
199
                </li>
180
                <li><label for="block_expired">Block expired patrons:</label>
200
                <li><label for="block_expired">Block expired patrons:</label>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt (-1 / +2 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Categories %]
4
[% SET footerjs = 1 %]
5
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; 
7
<title>Koha &rsaquo; 
Lines 42-48 Link Here
42
43
43
[% IF too_many_login_attempts %]
44
[% IF too_many_login_attempts %]
44
    <div id="login_error"><strong>Error: </strong>This account has been locked!</div>
45
    <div id="login_error"><strong>Error: </strong>This account has been locked!</div>
45
    [% IF Koha.Preference('OpacResetPassword') && Koha.Preference('OpacBaseURL') %]
46
    [% IF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
46
        <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
47
        <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
47
    [% END %]
48
    [% END %]
48
[% ELSIF invalid_username_or_password %]
49
[% ELSIF invalid_username_or_password %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-1 / +2 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Categories %]
4
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
5
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
5
<div id="wrap">
6
<div id="wrap">
6
    <div id="header-region" class="noprint">
7
    <div id="header-region" class="noprint">
Lines 324-330 Link Here
324
                            [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
325
                            [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
325
                        </div>
326
                        </div>
326
                    [% END %]
327
                    [% END %]
327
                    [% IF Koha.Preference('OpacPasswordChange') && Koha.Preference('OpacResetPassword') %]
328
                    [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
328
                        <div id="forgotpassword-modal" class="forgotpassword">
329
                        <div id="forgotpassword-modal" class="forgotpassword">
329
                            <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
330
                            <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
330
                        </div>
331
                        </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt (-1 / +2 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Categories %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
5
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
5
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
6
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
Lines 169-175 Link Here
169
170
170
                            <input type="submit" value="Log in" class="btn" />
171
                            <input type="submit" value="Log in" class="btn" />
171
                            <p/>
172
                            <p/>
172
                            [% IF Koha.Preference('OpacPasswordChange') && Koha.Preference('OpacResetPassword') %]
173
                            [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
173
                                <div id="forgotpassword">
174
                                <div id="forgotpassword">
174
                                    <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
175
                                    <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
175
                                </div>
176
                                </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-1 / +2 lines)
Lines 2-7 Link Here
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE KohaDates %]
3
[% USE KohaDates %]
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE Categories %]
5
[% USE Price %]
6
[% USE Price %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
8
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
Lines 152-158 Link Here
152
                                                [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
153
                                                [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
153
                                            </div>
154
                                            </div>
154
                                        [% END %]
155
                                        [% END %]
155
                                        [% IF Koha.Preference('OpacPasswordChange') && Koha.Preference('OpacResetPassword') %]
156
                                        [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
156
                                            <div id="forgotpassword-main" class="forgotpassword">
157
                                            <div id="forgotpassword-main" class="forgotpassword">
157
                                                <p><a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a></p>
158
                                                <p><a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a></p>
158
                                            </div>
159
                                            </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt (-1 / +4 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Categories %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %] - Forgotten password recovery[% ELSE %]Koha online[% END %] catalog - Forgotten password recovery</title>
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %] - Forgotten password recovery[% ELSE %]Koha online[% END %] catalog - Forgotten password recovery</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 54-59 Link Here
54
                        <br/>Please try again later.
55
                        <br/>Please try again later.
55
                    [% ELSIF (errNoBorrowerFound) %]
56
                    [% ELSIF (errNoBorrowerFound) %]
56
                        No account was found with the provided information.
57
                        No account was found with the provided information.
58
                    [% ELSIF errResetForbidden %]
59
                        You are not allowed to reset your password. Contact library staff for assistance.
57
                    [% ELSIF (errMultipleAccountsForEmail) %]
60
                    [% ELSIF (errMultipleAccountsForEmail) %]
58
                        Account identification with this email address only is ambiguous.
61
                        Account identification with this email address only is ambiguous.
59
                        <br />Please use the field 'Login' as well.
62
                        <br />Please use the field 'Login' as well.
Lines 83-89 Link Here
83
                </div>
86
                </div>
84
            [% END %]
87
            [% END %]
85
                <div id="password-recovery">
88
                <div id="password-recovery">
86
[% IF (!Koha.Preference('OpacResetPassword')) %]
89
[% IF (! Categories.can_any_reset_password ) %]
87
                    <div class="alert alert-info">You can't reset your password.</div>
90
                    <div class="alert alert-info">You can't reset your password.</div>
88
[% ELSIF (password_recovery) %]
91
[% ELSIF (password_recovery) %]
89
                    <form action="/cgi-bin/koha/opac-password-recovery.pl" method="post" autocomplete="off">
92
                    <form action="/cgi-bin/koha/opac-password-recovery.pl" method="post" autocomplete="off">
(-)a/opac/opac-password-recovery.pl (-24 / +34 lines)
Lines 42-47 my $errMultipleAccountsForEmail; Link Here
42
my $errAlreadyStartRecovery;
42
my $errAlreadyStartRecovery;
43
my $errTooManyEmailFound;
43
my $errTooManyEmailFound;
44
my $errBadEmail;
44
my $errBadEmail;
45
my $errResetForbidden;
45
46
46
#new password form error
47
#new password form error
47
my $errLinkNotValid;
48
my $errLinkNotValid;
Lines 73-108 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
73
        $errMultipleAccountsForEmail = 1;
74
        $errMultipleAccountsForEmail = 1;
74
    }
75
    }
75
    elsif ( $borrower = $search_results->next() ) {    # One matching borrower
76
    elsif ( $borrower = $search_results->next() ) {    # One matching borrower
76
        my @emails = grep { $_ } ( $borrower->email, $borrower->emailpro, $borrower->B_email );
77
77
78
        my $firstNonEmptyEmail;
78
        if ( $borrower->category->effective_reset_password ) {
79
        $firstNonEmptyEmail = $emails[0] if @emails;
80
79
81
        # Is the given email one of the borrower's ?
80
            my @emails = grep { $_ } ( $borrower->email, $borrower->emailpro, $borrower->B_email );
82
        if ( $email && !( grep /^$email$/i, @emails ) ) {
83
            $hasError    = 1;
84
            $errNoBorrowerFound = 1;
85
        }
86
81
87
        # If there is no given email, and there is no email on record
82
            my $firstNonEmptyEmail;
88
        elsif ( !$email && !$firstNonEmptyEmail ) {
83
            $firstNonEmptyEmail = $emails[0] if @emails;
89
            $hasError           = 1;
84
90
            $errNoBorrowerEmail = 1;
85
            # Is the given email one of the borrower's ?
91
        }
86
            if ( $email && !( grep /^$email$/i, @emails ) ) {
87
                $hasError    = 1;
88
                $errNoBorrowerFound = 1;
89
            }
90
91
            # If there is no given email, and there is no email on record
92
            elsif ( !$email && !$firstNonEmptyEmail ) {
93
                $hasError           = 1;
94
                $errNoBorrowerEmail = 1;
95
            }
92
96
93
# Check if a password reset already issued for this borrower AND we are not asking for a new email
97
            # Check if a password reset already issued for this
94
        elsif ( not $query->param('resendEmail') ) {
98
            # borrower AND we are not asking for a new email
95
            if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) {
99
            elsif ( not $query->param('resendEmail') ) {
96
                $hasError                = 1;
100
                if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) {
97
                $errAlreadyStartRecovery = 1;
101
                    $hasError                = 1;
102
                    $errAlreadyStartRecovery = 1;
103
                }
104
                else {
105
                    DeleteExpiredPasswordRecovery( $borrower->borrowernumber );
106
                }
98
            }
107
            }
99
            else {
108
            # Set the $email, if we don't have one.
100
                DeleteExpiredPasswordRecovery( $borrower->borrowernumber );
109
            if ( !$hasError && !$email ) {
110
                $email = $firstNonEmptyEmail;
101
            }
111
            }
102
        }
112
        }
103
        # Set the $email, if we don't have one.
113
        else {
104
        if ( !$hasError && !$email ) {
114
            $hasError          = 1;
105
            $email = $firstNonEmptyEmail;
115
            $errResetForbidden = 1;
106
        }
116
        }
107
    }
117
    }
108
    else {    # 0 matching borrower
118
    else {    # 0 matching borrower
Lines 118-123 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
118
            errBadEmail             => $errBadEmail,
128
            errBadEmail             => $errBadEmail,
119
            errNoBorrowerEmail      => $errNoBorrowerEmail,
129
            errNoBorrowerEmail      => $errNoBorrowerEmail,
120
            errMultipleAccountsForEmail => $errMultipleAccountsForEmail,
130
            errMultipleAccountsForEmail => $errMultipleAccountsForEmail,
131
            errResetForbidden       => $errResetForbidden,
121
            password_recovery       => 1,
132
            password_recovery       => 1,
122
            email                   => HTML::Entities::encode($email),
133
            email                   => HTML::Entities::encode($email),
123
            username                => $username
134
            username                => $username
124
- 

Return to bug 21890