Bugzilla – Attachment 167587 Details for
Bug 33462
Force password change for new patrons entered by staff
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33462: (Follow up) Fix Perl Tidy
Bug-33462-Follow-up-Fix-Perl-Tidy.patch (text/plain), 13.79 KB, created by
Sam Lau
on 2024-06-07 19:42:51 UTC
(
hide
)
Description:
Bug 33462: (Follow up) Fix Perl Tidy
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2024-06-07 19:42:51 UTC
Size:
13.79 KB
patch
obsolete
>From 12613c2fc0575a54cc9aa27fda8b0d49f99e8630 Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Fri, 7 Jun 2024 19:26:51 +0000 >Subject: [PATCH] Bug 33462: (Follow up) Fix Perl Tidy > >--- > Koha/Patron.pm | 7 +- > admin/categories.pl | 133 +++++++++--------- > .../data/mysql/atomicupdate/bug_33462.pl | 12 +- > .../bootstrap/en/modules/opac-auth.tt | 2 +- > 4 files changed, 80 insertions(+), 74 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 8dd771fe54..fd0fbc6dfd 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -291,10 +291,11 @@ sub store { > # Make a copy of the plain text password for later use > $self->plain_text_password( $self->password ); > >- if($self->category->effective_force_password_reset_when_set_by_staff and ($self->categorycode ne C4::Context->preference("PatronSelfRegistrationDefaultCategory"))){ >+ if ( $self->category->effective_force_password_reset_when_set_by_staff >+ and ( $self->categorycode ne C4::Context->preference("PatronSelfRegistrationDefaultCategory") ) ) >+ { > $self->password_expiration_date(dt_from_string); >- } >- else { >+ } else { > $self->password_expiration_date( > $self->password > ? $self->category->get_password_expiry_date || undef >diff --git a/admin/categories.pl b/admin/categories.pl >index 18b5e8a53e..fc9ab5ad72 100755 >--- a/admin/categories.pl >+++ b/admin/categories.pl >@@ -52,47 +52,45 @@ if ( $op eq 'add_form' ) { > ); > > if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >- C4::Form::MessagingPreferences::set_form_values( >- { categorycode => $categorycode }, $template ); >+ C4::Form::MessagingPreferences::set_form_values( { categorycode => $categorycode }, $template ); > } >-} >-elsif ( $op eq 'cud-add_validate' ) { >- >- my $categorycode = $input->param('categorycode'); >- my $description = $input->param('description'); >- my $enrolmentperiod = $input->param('enrolmentperiod'); >- my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef; >- my $password_expiry_days = $input->param('password_expiry_days') || undef; >- my $upperagelimit = $input->param('upperagelimit'); >- my $dateofbirthrequired = $input->param('dateofbirthrequired'); >- my $enrolmentfee = $input->param('enrolmentfee'); >- my $reservefee = $input->param('reservefee'); >- my $hidelostitems = $input->param('hidelostitems'); >- my $overduenoticerequired = $input->param('overduenoticerequired'); >- my $category_type = $input->param('category_type'); >- my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions'); >- my $checkPrevCheckout = $input->param('checkprevcheckout'); >- my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1; >- my $default_privacy = $input->param('default_privacy'); >- my $reset_password = $input->param('reset_password'); >- my $change_password = $input->param('cud-change_password'); >- my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority'); >- my $min_password_length = $input->param('min_password_length'); >- my $require_strong_password = $input->param('require_strong_password'); >- my @branches = grep { $_ ne q{} } $input->multi_param('branches'); >- my $can_be_guarantee = $input->param('can_be_guarantee'); >+} elsif ( $op eq 'cud-add_validate' ) { >+ >+ my $categorycode = $input->param('categorycode'); >+ my $description = $input->param('description'); >+ my $enrolmentperiod = $input->param('enrolmentperiod'); >+ my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef; >+ my $password_expiry_days = $input->param('password_expiry_days') || undef; >+ my $upperagelimit = $input->param('upperagelimit'); >+ my $dateofbirthrequired = $input->param('dateofbirthrequired'); >+ my $enrolmentfee = $input->param('enrolmentfee'); >+ my $reservefee = $input->param('reservefee'); >+ my $hidelostitems = $input->param('hidelostitems'); >+ my $overduenoticerequired = $input->param('overduenoticerequired'); >+ my $category_type = $input->param('category_type'); >+ my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions'); >+ my $checkPrevCheckout = $input->param('checkprevcheckout'); >+ my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1; >+ my $default_privacy = $input->param('default_privacy'); >+ my $reset_password = $input->param('reset_password'); >+ my $change_password = $input->param('cud-change_password'); >+ my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority'); >+ my $min_password_length = $input->param('min_password_length'); >+ my $require_strong_password = $input->param('require_strong_password'); >+ my @branches = grep { $_ ne q{} } $input->multi_param('branches'); >+ my $can_be_guarantee = $input->param('can_be_guarantee'); > my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff'); > >- $reset_password = undef if $reset_password eq -1; >- $change_password = undef if $change_password eq -1; >- $min_password_length = undef unless length($min_password_length); >- $require_strong_password = undef if $require_strong_password eq -1; >+ $reset_password = undef if $reset_password eq -1; >+ $change_password = undef if $change_password eq -1; >+ $min_password_length = undef unless length($min_password_length); >+ $require_strong_password = undef if $require_strong_password eq -1; > $force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1; > > my $is_a_modif = $input->param("is_a_modif"); > > if ($is_a_modif) { >- my $category = Koha::Patron::Categories->find( $categorycode ); >+ my $category = Koha::Patron::Categories->find($categorycode); > $category->categorycode($categorycode); > $category->description($description); > $category->enrolmentperiod($enrolmentperiod); >@@ -120,44 +118,45 @@ elsif ( $op eq 'cud-add_validate' ) { > $category->store; > $category->replace_library_limits( \@branches ); > }; >- if ( $@ ) { >- push @messages, {type => 'error', code => 'error_on_update' }; >+ if ($@) { >+ push @messages, { type => 'error', code => 'error_on_update' }; > } else { > push @messages, { type => 'message', code => 'success_on_update' }; > } >- } >- else { >- my $category = Koha::Patron::Category->new({ >- categorycode => $categorycode, >- description => $description, >- enrolmentperiod => $enrolmentperiod, >- enrolmentperioddate => $enrolmentperioddate, >- password_expiry_days => $password_expiry_days, >- upperagelimit => $upperagelimit, >- dateofbirthrequired => $dateofbirthrequired, >- enrolmentfee => $enrolmentfee, >- reservefee => $reservefee, >- hidelostitems => $hidelostitems, >- overduenoticerequired => $overduenoticerequired, >- category_type => $category_type, >- can_be_guarantee => $can_be_guarantee, >- BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, >- checkprevcheckout => $checkPrevCheckout, >- can_place_ill_in_opac => $can_place_ill_in_opac, >- default_privacy => $default_privacy, >- reset_password => $reset_password, >- change_password => $change_password, >- exclude_from_local_holds_priority => $exclude_from_local_holds_priority, >- min_password_length => $min_password_length, >- require_strong_password => $require_strong_password, >- force_password_reset_when_set_by_staff => $force_password_reset_when_set_by_staff, >- }); >+ } else { >+ my $category = Koha::Patron::Category->new( >+ { >+ categorycode => $categorycode, >+ description => $description, >+ enrolmentperiod => $enrolmentperiod, >+ enrolmentperioddate => $enrolmentperioddate, >+ password_expiry_days => $password_expiry_days, >+ upperagelimit => $upperagelimit, >+ dateofbirthrequired => $dateofbirthrequired, >+ enrolmentfee => $enrolmentfee, >+ reservefee => $reservefee, >+ hidelostitems => $hidelostitems, >+ overduenoticerequired => $overduenoticerequired, >+ category_type => $category_type, >+ can_be_guarantee => $can_be_guarantee, >+ BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, >+ checkprevcheckout => $checkPrevCheckout, >+ can_place_ill_in_opac => $can_place_ill_in_opac, >+ default_privacy => $default_privacy, >+ reset_password => $reset_password, >+ change_password => $change_password, >+ exclude_from_local_holds_priority => $exclude_from_local_holds_priority, >+ min_password_length => $min_password_length, >+ require_strong_password => $require_strong_password, >+ force_password_reset_when_set_by_staff => $force_password_reset_when_set_by_staff, >+ } >+ ); > eval { > $category->store; > $category->replace_library_limits( \@branches ); > }; > >- if ( $@ ) { >+ if ($@) { > push @messages, { type => 'error', code => 'error_on_insert' }; > } else { > push @messages, { type => 'message', code => 'success_on_insert' }; >@@ -165,12 +164,14 @@ elsif ( $op eq 'cud-add_validate' ) { > } > > if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >- C4::Form::MessagingPreferences::handle_form_action( $input, >- { categorycode => scalar $input->param('categorycode') }, $template ); >+ C4::Form::MessagingPreferences::handle_form_action( >+ $input, >+ { categorycode => scalar $input->param('categorycode') }, $template >+ ); > } > > $searchfield = q||; >- $op = 'list'; >+ $op = 'list'; > } > elsif ( $op eq 'cud-delete_confirm' ) { > >diff --git a/installer/data/mysql/atomicupdate/bug_33462.pl b/installer/data/mysql/atomicupdate/bug_33462.pl >index d74effdfec..9751e3f28f 100755 >--- a/installer/data/mysql/atomicupdate/bug_33462.pl >+++ b/installer/data/mysql/atomicupdate/bug_33462.pl >@@ -7,14 +7,18 @@ return { > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; >- $dbh->do(q{ >+ $dbh->do( >+ q{ > INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) > VALUES ('ForcePasswordResetWhenSetByStaff', '0', NULL,'Force a staff created patron account to reset its password after its first OPAC login.', 'YesNo') >- }); >+ } >+ ); > say $out "Added new system preference 'ForcePasswordResetWhenSetByStaff'"; > >- if( !column_exists( 'categories', 'force_password_reset_when_set_by_staff' ) ) { >- $dbh->do("ALTER TABLE categories ADD COLUMN `force_password_reset_when_set_by_staff` TINYINT(1) NULL DEFAULT NULL AFTER `require_strong_password` -- if patrons of this category are required to reset password after being created by a staff member"); >+ if ( !column_exists( 'categories', 'force_password_reset_when_set_by_staff' ) ) { >+ $dbh->do( >+ "ALTER TABLE categories ADD COLUMN `force_password_reset_when_set_by_staff` TINYINT(1) NULL DEFAULT NULL AFTER `require_strong_password` -- if patrons of this category are required to reset password after being created by a staff member" >+ ); > } > > say $out "Added column to categories 'force_password_reset_when_set_by_staff'"; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >index 09bf94ac0b..5fbd5529a0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >@@ -189,7 +189,7 @@ > [% END # /UNLESS OPACShibOnly %] > > [% IF !(invalid_username_or_password || too_many_login_attempts) and password_has_expired %] >- [% IF date_enrolled == password_expiration_date %] >+ [% IF date_enrolled == password_expiration_date %] > <div class="alert alert-info"> > <p><strong>Error: </strong>It's your first login! You need to reset your password.</p> > </div> >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33462
:
153687
|
153688
|
153689
|
154395
|
154396
|
154397
|
167582
|
167583
|
167584
|
167585
|
167586
|
167587
|
167981
|
167982
|
167983
|
167984
|
167985
|
167986
|
168413
|
168414
|
168415
|
168416
|
168417
|
168418
|
168452
|
168453
|
168454
|
168455
|
168456
|
168457
|
171634
|
171635
|
171636
|
171637
|
171638
|
171639
|
171640
|
172030
|
172031
|
172032
|
172033
|
172034
|
172035
|
172036
|
172064
|
172065
|
172066
|
172067
|
172068
|
172069
|
172070
|
172071
|
173864
|
173865