Koha-clms/misc/admin
Tomas Cohen Arazi 78b659c1a9
Bug 40545: Add utility script for resetting 2FA settings
This adds a command-line utility script that allows administrators to reset
a patron's two-factor authentication settings when they lose access to their
authenticator device.

The script uses the new Koha::Patron methods and provides:
* Parameter validation (mutually exclusive userid/cardnumber/patron_id)
* User-friendly error messages and feedback
* Verification that patron has 2FA enabled before attempting reset

To test:
1. Enable TwoFactorAuthentication system preference
2. Set up 2FA for a test patron
3. Run:
   $ ktd --shell
  k$ perl misc/admin/reset_2fa.pl --userid <userid>
=> SUCCESS: Script resets 2FA and shows confirmation message
4. Verify patron can log in with password only
5. Test error cases:
   - No parameters: shows usage message
   - Multiple parameters: shows mutual exclusivity error
   - Non-existent user: shows user not found error
   - User without 2FA: shows informational message
=> SUCCESS: All scenarios work as expected
6. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-15 16:12:01 -06:00
..
koha-preferences Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
reset_2fa.pl Bug 40545: Add utility script for resetting 2FA settings 2025-10-15 16:12:01 -06:00
set_password.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00