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

(-)a/C4/Auth.pm (+2 lines)
Lines 1451-1456 sub checkauth { Link Here
1451
        opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
1451
        opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
1452
        too_many_login_attempts               => ( $patron and $patron->account_locked ),
1452
        too_many_login_attempts               => ( $patron and $patron->account_locked ),
1453
        password_has_expired                  => ( $patron and $patron->password_expired ),
1453
        password_has_expired                  => ( $patron and $patron->password_expired ),
1454
        password_expiration_date              => ( $patron and $patron->password_expiration_date ),
1455
        date_enrolled                         => ( $patron and $patron->dateenrolled ),
1454
        auth_error                            => $auth_error,
1456
        auth_error                            => $auth_error,
1455
    );
1457
    );
1456
1458
(-)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 189-197 Link Here
189
                        [% END # /UNLESS OPACShibOnly %]
189
                        [% END # /UNLESS OPACShibOnly %]
190
190
191
                        [% IF !(invalid_username_or_password || too_many_login_attempts) and password_has_expired %]
191
                        [% IF !(invalid_username_or_password || too_many_login_attempts) and password_has_expired %]
192
                            <div class="alert alert-info">
192
                            [% IF date_enrolled == password_expiration_date %]
193
                                <p><strong>Error: </strong>Your password has expired!</p>
193
                                <div class="alert alert-info">
194
                            </div>
194
                                    <p><strong>Error: </strong>It's your first login! You need to reset your password.</p>
195
                                </div>
196
                            [% ELSE %]
197
                                <div class="alert alert-info">
198
                                    <p><strong>Error: </strong>Your password has expired!</p>
199
                                </div>
200
                            [% END %]
195
                            [% IF Koha.Preference('EnableExpiredPasswordReset') %]
201
                            [% IF Koha.Preference('EnableExpiredPasswordReset') %]
196
                                <a href="/cgi-bin/koha/opac-reset-password.pl">Reset your password</a>.
202
                                <a href="/cgi-bin/koha/opac-reset-password.pl">Reset your password</a>.
197
                            [% ELSIF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
203
                            [% ELSIF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
198
- 

Return to bug 33462