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 %][% ELSE %]Koha online[% END %] catalog &rsaquo; Forgotten password recovery</title>
4
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; 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 43-48 my $errMultipleAccountsForEmail; Link Here
43
my $errAlreadyStartRecovery;
43
my $errAlreadyStartRecovery;
44
my $errTooManyEmailFound;
44
my $errTooManyEmailFound;
45
my $errBadEmail;
45
my $errBadEmail;
46
my $errResetForbidden;
46
47
47
#new password form error
48
#new password form error
48
my $errLinkNotValid;
49
my $errLinkNotValid;
Lines 74-109 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
74
        $errMultipleAccountsForEmail = 1;
75
        $errMultipleAccountsForEmail = 1;
75
    }
76
    }
76
    elsif ( $borrower = $search_results->next() ) {    # One matching borrower
77
    elsif ( $borrower = $search_results->next() ) {    # One matching borrower
77
        my @emails = grep { $_ } ( $borrower->email, $borrower->emailpro, $borrower->B_email );
78
78
79
        my $firstNonEmptyEmail;
79
        if ( $borrower->category->effective_reset_password ) {
80
        $firstNonEmptyEmail = $emails[0] if @emails;
81
80
82
        # Is the given email one of the borrower's ?
81
            my @emails = grep { $_ } ( $borrower->email, $borrower->emailpro, $borrower->B_email );
83
        if ( $email && !( grep /^$email$/i, @emails ) ) {
84
            $hasError    = 1;
85
            $errNoBorrowerFound = 1;
86
        }
87
82
88
        # If there is no given email, and there is no email on record
83
            my $firstNonEmptyEmail;
89
        elsif ( !$email && !$firstNonEmptyEmail ) {
84
            $firstNonEmptyEmail = $emails[0] if @emails;
90
            $hasError           = 1;
85
91
            $errNoBorrowerEmail = 1;
86
            # Is the given email one of the borrower's ?
92
        }
87
            if ( $email && !( grep /^$email$/i, @emails ) ) {
88
                $hasError    = 1;
89
                $errNoBorrowerFound = 1;
90
            }
91
92
            # If there is no given email, and there is no email on record
93
            elsif ( !$email && !$firstNonEmptyEmail ) {
94
                $hasError           = 1;
95
                $errNoBorrowerEmail = 1;
96
            }
93
97
94
# Check if a password reset already issued for this borrower AND we are not asking for a new email
98
            # Check if a password reset already issued for this
95
        elsif ( not $query->param('resendEmail') ) {
99
            # borrower AND we are not asking for a new email
96
            if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) {
100
            elsif ( not $query->param('resendEmail') ) {
97
                $hasError                = 1;
101
                if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) {
98
                $errAlreadyStartRecovery = 1;
102
                    $hasError                = 1;
103
                    $errAlreadyStartRecovery = 1;
104
                }
105
                else {
106
                    DeleteExpiredPasswordRecovery( $borrower->borrowernumber );
107
                }
99
            }
108
            }
100
            else {
109
            # Set the $email, if we don't have one.
101
                DeleteExpiredPasswordRecovery( $borrower->borrowernumber );
110
            if ( !$hasError && !$email ) {
111
                $email = $firstNonEmptyEmail;
102
            }
112
            }
103
        }
113
        }
104
        # Set the $email, if we don't have one.
114
        else {
105
        if ( !$hasError && !$email ) {
115
            $hasError          = 1;
106
            $email = $firstNonEmptyEmail;
116
            $errResetForbidden = 1;
107
        }
117
        }
108
    }
118
    }
109
    else {    # 0 matching borrower
119
    else {    # 0 matching borrower
Lines 119-124 if ( $query->param('sendEmail') || $query->param('resendEmail') ) { Link Here
119
            errBadEmail             => $errBadEmail,
129
            errBadEmail             => $errBadEmail,
120
            errNoBorrowerEmail      => $errNoBorrowerEmail,
130
            errNoBorrowerEmail      => $errNoBorrowerEmail,
121
            errMultipleAccountsForEmail => $errMultipleAccountsForEmail,
131
            errMultipleAccountsForEmail => $errMultipleAccountsForEmail,
132
            errResetForbidden       => $errResetForbidden,
122
            password_recovery       => 1,
133
            password_recovery       => 1,
123
            email                   => HTML::Entities::encode($email),
134
            email                   => HTML::Entities::encode($email),
124
            username                => $username
135
            username                => $username
125
- 

Return to bug 21890