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

(-)a/C4/Auth.pm (+2 lines)
Lines 1452-1457 sub checkauth { Link Here
1452
        opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
1452
        opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
1453
        too_many_login_attempts               => ( $patron and $patron->account_locked ),
1453
        too_many_login_attempts               => ( $patron and $patron->account_locked ),
1454
        password_has_expired                  => ( $patron and $patron->password_expired ),
1454
        password_has_expired                  => ( $patron and $patron->password_expired ),
1455
        password_expiration_date              => ( $patron and $patron->password_expiration_date ),
1456
        date_enrolled                         => ( $patron and $patron->dateenrolled ),
1455
        auth_error                            => $auth_error,
1457
        auth_error                            => $auth_error,
1456
    );
1458
    );
1457
1459
(-)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 187-192 sub effective_require_strong_password { Link Here
187
    return $self->require_strong_password // C4::Context->preference('RequireStrongPassword');
187
    return $self->require_strong_password // C4::Context->preference('RequireStrongPassword');
188
}
188
}
189
189
190
=head3 effective_force_password_reset_when_set_by_staff
191
192
    $category->effective_force_password_reset_when_set_by_staff()
193
194
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
195
or, if undef, falls back to the ForcePasswordResetWhenSetByStaff system preference.
196
197
=cut
198
199
sub effective_force_password_reset_when_set_by_staff {
200
    my ($self) = @_;
201
202
    return $self->force_password_reset_when_set_by_staff // C4::Context->preference('ForcePasswordResetWhenSetByStaff');
203
}
204
205
190
=head3 override_hidden_items
206
=head3 override_hidden_items
191
207
192
    if ( $patron->category->override_hidden_items ) {
208
    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 (+36 lines)
Lines 340-345 Link Here
340
                      [% END %]
340
                      [% END %]
341
                    </select>
341
                    </select>
342
                </li>
342
                </li>
343
                <li>
344
                    <label for="force_password_reset_when_set_by_staff">Force new patron password reset: </label>
345
                    <select name="force_password_reset_when_set_by_staff" id="force_password_reset_when_set_by_staff">
346
                        [% IF category.force_password_reset_when_set_by_staff.defined %]
347
                            [% IF category.force_password_reset_when_set_by_staff %]
348
                                [% IF Koha.Preference('ForcePasswordResetWhenSetByStaff') %]
349
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Force)</option>
350
                                [% ELSE %]
351
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Don't force)</option>
352
                                [% END %]
353
                                    <option value="1" selected="selected">Force</option>
354
                                    <option value="0">Don't force</option>
355
                            [% ELSE %]
356
                                [% IF Koha.Preference('ForcePasswordResetWhenSetByStaff') %]
357
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Force)</option>
358
                                [% ELSE %]
359
                                    <option value="-1">Follow system preference ForcePasswordResetWhenSetByStaff (Don't force)</option>
360
                                [% END %]
361
                                    <option value="1">Force</option>
362
                                    <option value="0" selected="selected">Don't force</option>
363
                            [% END %]
364
                        [% ELSE %]
365
                            [% IF Koha.Preference('ForcePasswordResetWhenSetByStaff') %]
366
                                <option value="-1" selected="selected">Follow system preference ForcePasswordResetWhenSetByStaff (Force)</option>
367
                            [% ELSE %]
368
                                <option value="-1" selected="selected">Follow system preference ForcePasswordResetWhenSetByStaff (Don't force)</option>
369
                            [% END %]
370
                                <option value="1">Force</option>
371
                                <option value="0">Don't force</option>
372
                        [% END %]
373
                    </select>
374
                    <div class="hint">
375
                        Choose whether staff created patrons of this category be forced into resetting their password after their first OPAC login.
376
                    </div>
377
                </li>
378
343
                <li><label for="block_expired">Block expired patrons:</label>
379
                <li><label for="block_expired">Block expired patrons:</label>
344
                    <select name="BlockExpiredPatronOpacActions" id="block_expired">
380
                    <select name="BlockExpiredPatronOpacActions" id="block_expired">
345
                        [% IF not category or category.BlockExpiredPatronOpacActions == -1%]
381
                        [% IF not category or category.BlockExpiredPatronOpacActions == -1%]
(-)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