From 24b466c7626ee6a6cb711a3a4b429928b70b51ae Mon Sep 17 00:00:00 2001 From: Jacob O'Mara Date: Thu, 14 Aug 2025 11:20:52 +0100 Subject: [PATCH] Bug 40824: Add category-level password history count support Add effective_password_history_count method to Patron::Category that returns category-specific password_history_count or falls back to system preference PasswordHistoryCount --- Koha/Patron/Category.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm index ab4973b544a..4cf3a44d173 100644 --- a/Koha/Patron/Category.pm +++ b/Koha/Patron/Category.pm @@ -251,6 +251,21 @@ sub effective_force_password_reset_when_set_by_staff { return $self->force_password_reset_when_set_by_staff // C4::Context->preference('ForcePasswordResetWhenSetByStaff'); } +=head3 effective_password_history_count + + $category->effective_password_history_count() + +Returns the number of previous passwords to check against when changing password. +If set in $self->password_history_count or, if undef, falls back to the PasswordHistoryCount +system preference. + +=cut + +sub effective_password_history_count { + my ($self) = @_; + return $self->password_history_count // C4::Context->preference('PasswordHistoryCount'); +} + =head3 override_hidden_items if ( $patron->category->override_hidden_items ) { -- 2.39.5