Bugzilla – Attachment 186518 Details for
Bug 40824
Add option to prevent re-use of passwords
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40824: Show error for password history clash in memberentrygen.tt
Bug-40824-Show-error-for-password-history-clash-in.patch (text/plain), 4.01 KB, created by
Jacob O'Mara
on 2025-09-17 09:47:44 UTC
(
hide
)
Description:
Bug 40824: Show error for password history clash in memberentrygen.tt
Filename:
MIME Type:
Creator:
Jacob O'Mara
Created:
2025-09-17 09:47:44 UTC
Size:
4.01 KB
patch
obsolete
>From fcc1c09b513afb7320a9986696cb7817bfcabd26 Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <jacob.omara@openfifth.co.uk> >Date: Thu, 10 Apr 2025 12:31:47 +0100 >Subject: [PATCH] Bug 40824: Show error for password history clash in > memberentrygen.tt > >--- > .../prog/en/modules/members/memberentrygen.tt | 6 ++++++ > members/memberentry.pl | 20 +++++++++++++++++-- > 2 files changed, 24 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index a4cee866f38..ee1d7cc2421 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -203,6 +203,9 @@ > [% IF ( ERROR_invalid_relationship ) %] > <li id="ERROR_invalid_relationship">Guarantor relationship cannot be left blank according to configuration.</li> > [% END %] >+ [% IF ( ERROR_password_used_before ) %] >+ <li id="ERROR_used_before">This password has been used before. You cannot reuse any of your last [% password_history_count | html %] passwords.</li> >+ [% END %] > </ul> > </div> > [% END %] >@@ -1234,6 +1237,9 @@ > [% IF ( ERROR_password_has_whitespaces ) %] > <span class="required">Password has leading or trailing whitespaces</span> > [% END %] >+ [% IF ( ERROR_password_used_before ) %] >+ <span class="required">Password has been used before</span> >+ [% END %] > <div class="hint">Minimum password length: [% patron.category.effective_min_password_length | html %]</div> > </li> > >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 5f15a105556..a567066e78e 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -48,6 +48,7 @@ use Koha::Patron::HouseboundRoles; > use Koha::Policy::Patrons::Cardnumber; > use Koha::Plugins; > use Koha::SMS::Providers; >+use Koha::PatronPasswordHistories; > > my $input = CGI->new; > my %data; >@@ -391,6 +392,21 @@ if ( $op eq 'cud-save' || $op eq 'cud-insert' ) { > push @errors, 'ERROR_password_too_weak' if $error eq 'too_weak'; > push @errors, 'ERROR_password_has_whitespaces' if $error eq 'has_whitespaces'; > } >+ >+ # Check password history >+ if ($patron && $is_valid) { # Only check if other validations passed and we have a patron >+ my $is_used = Koha::PatronPasswordHistories->has_used_password({ >+ borrowernumber => $patron->borrowernumber, >+ password => $password, >+ current_password => $patron->password >+ }); >+ >+ if ($is_used) { >+ push @errors, 'ERROR_password_used_before'; >+ my $count = C4::Context->preference('PasswordHistoryCount') || 0; >+ $template->param( password_history_count => $count ); >+ } >+ } > } > > # Validate emails >@@ -611,9 +627,9 @@ if ( ( !$nok ) and $nodouble and ( $op eq 'cud-insert' or $op eq 'cud-save' ) ) > } > } > >- # should never raise an exception as password validity is checked above >+ # password validity has been checked above > my $password = $newdata{password}; >- if ( $password and $password ne '****' ) { >+ if ( $password and $password ne '****' and $success ) { > $patron->set_password( { password => $password } ); > } > >-- >2.39.5
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 40824
:
186511
|
186512
|
186513
|
186514
|
186515
|
186516
|
186517
| 186518 |
186519
|
186520
|
186521
|
186522
|
186523
|
186524
|
186525
|
186526
|
186527