Bug 28787: Send a notice with the TOTP token
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 23 May 2022 20:51:26 +0000 (22:51 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 9 Aug 2022 16:38:43 +0000 (13:38 -0300)
commit6e099d0bbdd8921715fd7bcd1b993110f1fddfff
treee6aa885c06e6c3b812ec375360f30f7ff749b4b5
parent244c64925036ec4a7541de213b7d807519f56495
Bug 28787: Send a notice with the TOTP token

Bug 28786 let librarians enable a Two-factor authentication but force them to use
an application to generate the TOTP token.

This new enhancement add the ability to send an email containing the token to the
patron once it's authenticaed

The new notice template has the code '2FA_OTP_TOKEN'

Test plan:
- Setup the two-factor authentication (you need the config entry and the
syspref ON)
- Enable it for your logged in patron
- Logout
- Login and notice the new link "Send the code by email"
- Click on it and confirm that you received an email with the code
- Use the code to be fully logged in

QA question: Is 400 the correct error code to tell the email has not
been sent?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Sponsored-by: Rijksmuseum, Netherlands
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Letters.pm
Koha/REST/V1/Auth.pm
Koha/REST/V1/TwoFactorAuth.pm [new file with mode: 0644]
api/v1/swagger/paths/auth.yaml [new file with mode: 0644]
api/v1/swagger/swagger.yaml
installer/data/mysql/atomicupdate/bug_28787.pl [new file with mode: 0755]
installer/data/mysql/en/mandatory/sample_notices.yml
koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
t/db_dependent/api/v1/two_factor_auth.t [new file with mode: 0755]
t/db_dependent/selenium/authentication_2fa.t