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 81-91 elsif ( $op eq 'cud-add_validate' ) { Link Here
81
    my $require_strong_password = $input->param('require_strong_password');
81
    my $require_strong_password = $input->param('require_strong_password');
82
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
82
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
83
    my $can_be_guarantee = $input->param('can_be_guarantee');
83
    my $can_be_guarantee = $input->param('can_be_guarantee');
84
    my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff');
84
85
85
    $reset_password = undef if $reset_password eq -1;
86
    $reset_password = undef if $reset_password eq -1;
86
    $change_password = undef if $change_password eq -1;
87
    $change_password = undef if $change_password eq -1;
87
    $min_password_length = undef unless length($min_password_length);
88
    $min_password_length = undef unless length($min_password_length);
88
    $require_strong_password = undef if $require_strong_password eq -1;
89
    $require_strong_password = undef if $require_strong_password eq -1;
90
    $force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1;
89
91
90
    my $is_a_modif = $input->param("is_a_modif");
92
    my $is_a_modif = $input->param("is_a_modif");
91
93
Lines 113-118 elsif ( $op eq 'cud-add_validate' ) { Link Here
113
        $category->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
115
        $category->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
114
        $category->min_password_length($min_password_length);
116
        $category->min_password_length($min_password_length);
115
        $category->require_strong_password($require_strong_password);
117
        $category->require_strong_password($require_strong_password);
118
        $category->force_password_reset_when_set_by_staff($force_password_reset_when_set_by_staff);
116
        eval {
119
        eval {
117
            $category->store;
120
            $category->store;
118
            $category->replace_library_limits( \@branches );
121
            $category->replace_library_limits( \@branches );
Lines 147-152 elsif ( $op eq 'cud-add_validate' ) { Link Here
147
            exclude_from_local_holds_priority => $exclude_from_local_holds_priority,
150
            exclude_from_local_holds_priority => $exclude_from_local_holds_priority,
148
            min_password_length => $min_password_length,
151
            min_password_length => $min_password_length,
149
            require_strong_password => $require_strong_password,
152
            require_strong_password => $require_strong_password,
153
            force_password_reset_when_set_by_staff => $force_password_reset_when_set_by_staff,
150
        });
154
        });
151
        eval {
155
        eval {
152
            $category->store;
156
            $category->store;
(-)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 197-205 Link Here
197
                        [% END %]
197
                        [% END %]
198
198
199
                        [% IF !(invalid_username_or_password || too_many_login_attempts) and password_has_expired %]
199
                        [% IF !(invalid_username_or_password || too_many_login_attempts) and password_has_expired %]
200
                            <div class="alert alert-info">
200
                            [% IF date_enrolled == password_expiration_date %]
201
                                <p><strong>Error: </strong>Your password has expired!</p>
201
                                <div class="alert alert-info">
202
                            </div>
202
                                    <p><strong>Error: </strong>It's your first login! You need to reset your password.</p>
203
                                </div>
204
                            [% ELSE %]
205
                                <div class="alert alert-info">
206
                                    <p><strong>Error: </strong>Your password has expired!</p>
207
                                </div>
208
                            [% END %]
203
                            [% IF Koha.Preference('EnableExpiredPasswordReset') %]
209
                            [% IF Koha.Preference('EnableExpiredPasswordReset') %]
204
                                <a href="/cgi-bin/koha/opac-reset-password.pl">Reset your password</a>.
210
                                <a href="/cgi-bin/koha/opac-reset-password.pl">Reset your password</a>.
205
                            [% ELSIF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
211
                            [% ELSIF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
206
- 

Return to bug 33462