I propose we have an utility script for the task.
Created attachment 184839 [details] [review] Bug 40545: Add has_2fa_enabled and reset_2fa methods to Koha::Patron This adds two new methods to Koha::Patron for managing two-factor authentication: * has_2fa_enabled() - Returns 1 if patron has 2FA enabled, 0 otherwise * reset_2fa() - Clears secret and sets auth_method to 'password' The reset_2fa method includes audit logging when BorrowersLog is enabled and returns the patron object for method chaining. To test: 1. Apply patch 2. Run: prove t/db_dependent/Koha/Patron.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 184840 [details] [review] 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: perl misc/admin/reset_2fa.pl --userid <userid> => SUCCESS: Script resets 2FA and shows confirmation message => FAIL: Script shows error or doesn't reset 2FA properly 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
Created attachment 184841 [details] [review] Bug 40545: Add to action logs
Created attachment 184842 [details] [review] Bug 40545: Add has_2fa_enabled and reset_2fa methods to Koha::Patron This adds two new methods to Koha::Patron for managing two-factor authentication: * has_2fa_enabled() - Returns 1 if patron has 2FA enabled, 0 otherwise * reset_2fa() - Clears secret and sets auth_method to 'password' The reset_2fa method includes audit logging when BorrowersLog is enabled and returns the patron object for method chaining. To test: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Patron.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 184843 [details] [review] 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
Created attachment 184844 [details] [review] Bug 40545: Add to action logs
Created attachment 184850 [details] [review] Bug 40545: Add has_2fa_enabled and reset_2fa methods to Koha::Patron This adds two new methods to Koha::Patron for managing two-factor authentication: * has_2fa_enabled() - Returns 1 if patron has 2FA enabled, 0 otherwise * reset_2fa() - Clears secret and sets auth_method to 'password' The reset_2fa method includes audit logging when BorrowersLog is enabled and returns the patron object for method chaining. To test: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Patron.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Created attachment 184851 [details] [review] 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 Signed-off-by: David Nind <david@davidnind.com>
Created attachment 184852 [details] [review] Bug 40545: Add to action logs Signed-off-by: David Nind <david@davidnind.com>
Nice!
The patches currently don't apply: git bz apply 40545 Bug 40545 - Add a CLI script to manually reset 2FA settings 184850 - Bug 40545: Add has_2fa_enabled and reset_2fa methods to Koha::Patron 184851 - Bug 40545: Add utility script for resetting 2FA settings 184852 - Bug 40545: Add to action logs Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 40545: Add has_2fa_enabled and reset_2fa methods to Koha::Patron Applying: Bug 40545: Add utility script for resetting 2FA settings Applying: Bug 40545: Add to action logs Using index info to reconstruct a base tree... M koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc M koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt Falling back to patching base and 3-way merge... Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc error: Failed to merge in the changes. Patch failed at 0001 Bug 40545: Add to action logs