Bug 33904: Fix 2FA registration when library name has non-latin characters
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 6 Jun 2023 08:42:20 +0000 (10:42 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 26 Jun 2023 12:58:20 +0000 (14:58 +0200)
commit6678645740787c2e57874eabe4363edd98769d6f
tree7720f8b9c10fd18af92fff3315f1d38b28e87420
parent80dec321bdfc9be130a95e55fc58298d56b55945
Bug 33904: Fix 2FA registration when library name has non-latin characters

If the library name contains non-latin characters, the 2FA registration
process will fail with a JS alert coming from a 500 server-side.

The problem is that Auth::GoogleAuth is expecting an already UTF8 encoded string.
We should set the encoding correctly to make Auth::GoogleAuth deal with
the URL escaping internally correctly, then decode on our own (in the
REST API controller)

Test plan:
* Modify your logged in library name and add some non-latin characters
(eg. "my ❤ library")
* Turn on TwoFactorAuthentication
* Go to your account > More > Manage 2FA
* Click the enable button
=> Notice that you see the QR code and that both "issuer" and "key id"
entries display the library name correctly.
* Test the whole 2FA process, confirm that the library name is correctly
displayed on the app you are using.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit deeb5ebdbd59956f5f6cf1bfa989ef41c9af9720)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Auth/TwoFactorAuth.pm
Koha/REST/V1/TwoFactorAuth.pm