Bugzilla – Attachment 185239 Details for
Bug 40608
Password not changed if PASSWORD_CHANGE letter absent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40608: Continue password change even if notification fails
Bug-40608-Continue-password-change-even-if-notific.patch (text/plain), 2.86 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-08-07 19:25:43 UTC
(
hide
)
Description:
Bug 40608: Continue password change even if notification fails
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-08-07 19:25:43 UTC
Size:
2.86 KB
patch
obsolete
>From 649eb6fa5c6ff7314f399d0aa970c82e8f414727 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 6 Aug 2025 16:03:28 -0300 >Subject: [PATCH] Bug 40608: Continue password change even if notification > fails > >When NotifyPasswordChange is enabled and GetPreparedLetter fails to find >a PASSWORD_CHANGE letter template, the set_password method was returning >early with undef, preventing the password from being changed. > >This fixes the issue by: >1. Removing the 'or return;' statement after GetPreparedLetter >2. Wrapping the letter processing in an if block to handle missing templates >3. Ensuring password change continues regardless of notification success > >The password change should not fail just because the notification cannot >be sent. The notification is a nice-to-have feature, but the core >functionality (changing the password) should always work. > >Test plan: >1. Apply the tests patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Patron.t >=> FAIL: Tests fail! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Verify that when the letter template exists, notifications are still sent >6. Verify that when NotifyPasswordChange is disabled, password changes work >7. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Flater <flaterdavid@gmail.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Patron.pm | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index cfa570e0f00..b5c9faef43b 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1109,17 +1109,19 @@ sub set_password { > 'borrowers' => $self_from_storage->borrowernumber, > }, > want_librarian => 1, >- ) or return; >- >- my $message_id = C4::Letters::EnqueueLetter( >- { >- letter => $letter, >- borrowernumber => $self_from_storage->id, >- to_address => $emailaddr, >- message_transport_type => 'email' >- } > ); >- C4::Letters::SendQueuedMessages( { message_id => $message_id } ) if $message_id; >+ >+ if ($letter) { >+ my $message_id = C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $self_from_storage->id, >+ to_address => $emailaddr, >+ message_transport_type => 'email' >+ } >+ ); >+ C4::Letters::SendQueuedMessages( { message_id => $message_id } ) if $message_id; >+ } > } > } > } >-- >2.50.1
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 40608
:
185166
|
185167
|
185179
|
185238
|
185239
|
185240
|
185241
|
185257
|
185258
|
185259
|
185260
|
185261