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

(-)a/C4/Auth.pm (+2 lines)
Lines 1457-1462 sub checkauth { Link Here
1457
        too_many_login_attempts               => ( $patron and $patron->account_locked ),
1457
        too_many_login_attempts               => ( $patron and $patron->account_locked ),
1458
        password_has_expired                  => ( $patron and $patron->password_expired ),
1458
        password_has_expired                  => ( $patron and $patron->password_expired ),
1459
        is_anonymous_patron                   => ( $is_anonymous_patron ),
1459
        is_anonymous_patron                   => ( $is_anonymous_patron ),
1460
        password_expiration_date              => ( $patron and $patron->password_expiration_date ),
1461
        date_enrolled                         => ( $patron and $patron->dateenrolled ),
1460
        auth_error                            => $auth_error,
1462
        auth_error                            => $auth_error,
1461
    );
1463
    );
1462
1464
(-)a/Koha/Patron.pm (-5 / +10 lines)
Lines 291-301 sub store { Link Here
291
                # Make a copy of the plain text password for later use
291
                # Make a copy of the plain text password for later use
292
                $self->plain_text_password( $self->password );
292
                $self->plain_text_password( $self->password );
293
293
294
                $self->password_expiration_date(
294
                if($self->category->effective_force_password_reset_when_set_by_staff and ($self->categorycode ne C4::Context->preference("PatronSelfRegistrationDefaultCategory"))){
295
                      $self->password
295
                    $self->password_expiration_date(dt_from_string);
296
                    ? $self->category->get_password_expiry_date || undef
296
                }
297
                    : undef
297
                else {
298
                );
298
                    $self->password_expiration_date(
299
                          $self->password
300
                        ? $self->category->get_password_expiry_date || undef
301
                        : undef
302
                    );
303
                }
299
304
300
                # Create a disabled account if no password provided
305
                # Create a disabled account if no password provided
301
                $self->password(
306
                $self->password(
(-)a/Koha/Patron/Category.pm (+16 lines)
Lines 229-234 sub effective_require_strong_password { Link Here
229
    return $self->require_strong_password // C4::Context->preference('RequireStrongPassword');
229
    return $self->require_strong_password // C4::Context->preference('RequireStrongPassword');
230
}
230
}
231
231
232
=head3 effective_force_password_reset_when_set_by_staff
233
234
    $category->effective_force_password_reset_when_set_by_staff()
235
236
Returns if new staff created patrons in this category are forced to reset their password. If set in $self->force_password_reset_when_set_by_staff
237
or, if undef, falls back to the ForcePasswordResetWhenSetByStaff system preference.
238
239
=cut
240
241
sub effective_force_password_reset_when_set_by_staff {
242
    my ($self) = @_;
243
244
    return $self->force_password_reset_when_set_by_staff // C4::Context->preference('ForcePasswordResetWhenSetByStaff');
245
}
246
247
232
=head3 override_hidden_items
248
=head3 override_hidden_items
233
249
234
    if ( $patron->category->override_hidden_items ) {
250
    if ( $patron->category->override_hidden_items ) {
(-)a/admin/categories.pl (+4 lines)
Lines 84-94 elsif ( $op eq 'cud-add_validate' ) { Link Here
84
84
85
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
85
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
86
    my $can_be_guarantee = $input->param('can_be_guarantee');
86
    my $can_be_guarantee = $input->param('can_be_guarantee');
87
    my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff');
87
88
88
    $reset_password = undef if $reset_password eq -1;
89
    $reset_password = undef if $reset_password eq -1;
89
    $change_password = undef if $change_password eq -1;
90
    $change_password = undef if $change_password eq -1;
90
    $min_password_length = undef unless length($min_password_length);
91
    $min_password_length = undef unless length($min_password_length);
91
    $require_strong_password = undef if $require_strong_password eq -1;
92
    $require_strong_password = undef if $require_strong_password eq -1;
93
    $force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1;
92
94
93
    my $is_a_modif = $input->param("is_a_modif");
95
    my $is_a_modif = $input->param("is_a_modif");
94
96
Lines 119-124 elsif ( $op eq 'cud-add_validate' ) { Link Here
119
        $category->noissuescharge($noissuescharge);
121
        $category->noissuescharge($noissuescharge);
120
        $category->noissueschargeguarantees($noissueschargeguarantees);
122
        $category->noissueschargeguarantees($noissueschargeguarantees);
121
        $category->noissueschargeguarantorswithguarantees($noissueschargeguarantorswithguarantees);
123
        $category->noissueschargeguarantorswithguarantees($noissueschargeguarantorswithguarantees);
124
        $category->force_password_reset_when_set_by_staff($force_password_reset_when_set_by_staff);
122
        eval {
125
        eval {
123
            $category->store;
126
            $category->store;
124
            $category->replace_library_limits( \@branches );
127
            $category->replace_library_limits( \@branches );
Lines 157-162 elsif ( $op eq 'cud-add_validate' ) { Link Here
157
                noissuescharge                         => $noissuescharge,
160
                noissuescharge                         => $noissuescharge,
158
                noissueschargeguarantees               => $noissueschargeguarantees,
161
                noissueschargeguarantees               => $noissueschargeguarantees,
159
                noissueschargeguarantorswithguarantees => $noissueschargeguarantorswithguarantees,
162
                noissueschargeguarantorswithguarantees => $noissueschargeguarantorswithguarantees,
163
                force_password_reset_when_set_by_staff => $force_password_reset_when_set_by_staff,
160
            }
164
            }
161
        );
165
        );
162
        eval {
166
        eval {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+35 lines)
Lines 341-346 Link Here
341
                      [% END %]
341
                      [% END %]
342
                    </select>
342
                    </select>
343
                </li>
343
                </li>
344
                <li>
345
                    <label for="force_password_reset_when_set_by_staff">Force new patron password reset: </label>
346
                    <select name="force_password_reset_when_set_by_staff" id="force_password_reset_when_set_by_staff">
347
                        [% IF category.force_password_reset_when_set_by_staff.defined %]
348
                            [% IF category.force_password_reset_when_set_by_staff %]
349
                                [% IF Koha.Preference('ForcePasswordResetWhenSetByStaff') %]
350
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Force)</option>
351
                                [% ELSE %]
352
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Don't force)</option>
353
                                [% END %]
354
                                    <option value="1" selected="selected">Force</option>
355
                                    <option value="0">Don't force</option>
356
                            [% ELSE %]
357
                                [% IF Koha.Preference('ForcePasswordResetWhenSetByStaff') %]
358
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Force)</option>
359
                                [% ELSE %]
360
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Don't force)</option>
361
                                [% END %]
362
                                    <option value="1">Force</option>
363
                                    <option value="0" selected="selected">Don't force</option>
364
                            [% END %]
365
                        [% ELSE %]
366
                            [% IF Koha.Preference('ForcePasswordResetWhenSetByStaff') %]
367
                                <option value="-1" selected="selected">Follow system preference ForcePasswordResetWhenSetByStaff (Force)</option>
368
                            [% ELSE %]
369
                                <option value="-1" selected="selected">Follow system preference ForcePasswordResetWhenSetByStaff (Don't force)</option>
370
                            [% END %]
371
                                <option value="1">Force</option>
372
                                <option value="0">Don't force</option>
373
                        [% END %]
374
                    </select>
375
                    <div class="hint">
376
                        Choose whether staff created patrons of this category be forced into resetting their password after their first OPAC login.
377
                    </div>
378
                </li>
344
                <li><label for="block_expired">Block expired patron OPAC actions:</label>
379
                <li><label for="block_expired">Block expired patron OPAC actions:</label>
345
                    <select name="BlockExpiredPatronOpacActions" id="block_expired" multiple="multiple">
380
                    <select name="BlockExpiredPatronOpacActions" id="block_expired" multiple="multiple">
346
                        <optgroup label="Follow system preference">
381
                        <optgroup label="Follow system preference">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 1-4 Link Here
1
fPatrons:
1
Patrons:
2
    General:
2
    General:
3
     -
3
     -
4
         - pref: CheckPrevCheckout
4
         - pref: CheckPrevCheckout
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt (-4 / +9 lines)
Lines 202-210 Link Here
202
                        [% END %]
202
                        [% END %]
203
203
204
                        [% IF !(invalid_username_or_password || too_many_login_attempts) and password_has_expired %]
204
                        [% IF !(invalid_username_or_password || too_many_login_attempts) and password_has_expired %]
205
                            <div class="alert alert-info">
205
                            [% IF date_enrolled == password_expiration_date %]
206
                                <p><strong>Error: </strong>Your password has expired!</p>
206
                                <div class="alert alert-info">
207
                            </div>
207
                                    <p><strong>Error: </strong>It's your first login! You need to reset your password.</p>
208
                                </div>
209
                            [% ELSE %]
210
                                <div class="alert alert-info">
211
                                    <p><strong>Error: </strong>Your password has expired!</p>
212
                                </div>
213
                            [% END %]
208
                            [% IF Koha.Preference('EnableExpiredPasswordReset') %]
214
                            [% IF Koha.Preference('EnableExpiredPasswordReset') %]
209
                                <a href="/cgi-bin/koha/opac-reset-password.pl">Reset your password</a>.
215
                                <a href="/cgi-bin/koha/opac-reset-password.pl">Reset your password</a>.
210
                            [% ELSIF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
216
                            [% ELSIF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
211
- 

Return to bug 33462