From 501078cd738cf0083b9aa87342d1295ea413f3cb Mon Sep 17 00:00:00 2001 From: Jacob O'Mara Date: Thu, 10 Apr 2025 12:32:26 +0100 Subject: [PATCH] Bug 40824: Show error for password history clash in opac-reset-password.tt --- .../opac-tmpl/bootstrap/en/modules/opac-reset-password.tt | 2 ++ opac/opac-reset-password.pl | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reset-password.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reset-password.tt index 25331ff0685..61b47ca3a3f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reset-password.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reset-password.tt @@ -39,6 +39,8 @@ Password must contain at least one digit, one lowercase and one uppercase. [% CASE 'password_has_whitespaces' %] Password must not contain leading or trailing whitespaces. + [% CASE 'password_used_before' %] + This password has been used before. You cannot reuse any of your last [% password_history_count | html %] passwords. [% CASE 'invalid_credentials' %] You entered an incorrect username or password. Please try again! But note that passwords are case diff --git a/opac/opac-reset-password.pl b/opac/opac-reset-password.pl index ed30332c082..2ca8c6f8956 100755 --- a/opac/opac-reset-password.pl +++ b/opac/opac-reset-password.pl @@ -71,6 +71,10 @@ if ( $op eq 'cud-update' ) { if $_->isa('Koha::Exceptions::Password::TooWeak'); $error = 'password_has_whitespaces' if $_->isa('Koha::Exceptions::Password::WhitespaceCharacters'); + if ($_->isa('Koha::Exceptions::Password::UsedBefore')) { + $template->param( password_used_before => 1 ); + $template->param( password_history_count => C4::Context->preference('PasswordHistoryCount') ); + } $template->param( 'error' => $error ); }; } -- 2.39.5