https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44230 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 212402 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212402&action=edit Bug 44230: Add 'notify' to POST /patrons/{patron_id}/password This patch adds an optional `notify` boolean attribute to the request body of POST /patrons/{patron_id}/password so API consumers can decide, per request, whether the patron gets the PASSWORD_CHANGE notice: * notify: true -> send the notice, even if NotifyPasswordChange is disabled * notify: false -> do not send the notice, even if NotifyPasswordChange is enabled * not passed -> current behavior (NotifyPasswordChange decides) To support it, Koha::Patron->set_password gets an optional `notify` parameter that, when defined, takes precedence over the NotifyPasswordChange system preference. The existing conditions still apply: the notice is only sent if the password actually changes and the patron has a notice email address. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ yarn api:bundle k$ prove xt/api.t \ t/db_dependent/Koha/Patron.t \ t/db_dependent/Koha/Patrons.t \ t/db_dependent/api/v1/patrons_password.t => SUCCESS: Tests pass! 3. Restart services: k$ restart_all 4. Enable RESTBasicAuth and NotifyPasswordChange, and pick a patron with an email address 5. Change the patron's password, passing "notify": false: $ curl -u koha:koha -X POST \ http://localhost:8081/api/v1/patrons/<patron_id>/password \ -H 'Content-Type: application/json' \ -d '{"password":"Abcd1234!","password_2":"Abcd1234!","notify":false}' 6. Check the patron's notices tab => SUCCESS: No 'Password change' notice was generated 7. Repeat 5 with a new password and without "notify" => SUCCESS: A 'Password change' notice was generated 8. Disable NotifyPasswordChange and repeat 5 with a new password and "notify": true => SUCCESS: A 'Password change' notice was generated 9. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.