Bugzilla – Attachment 152197 Details for
Bug 33904
2FA registration fails if library name has non-latin characters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33904: Fix 2FA registration when library name has non-latin characters
Bug-33904-Fix-2FA-registration-when-library-name-h.patch (text/plain), 2.43 KB, created by
Martin Renvoize (ashimema)
on 2023-06-08 13:54:41 UTC
(
hide
)
Description:
Bug 33904: Fix 2FA registration when library name has non-latin characters
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-06-08 13:54:41 UTC
Size:
2.43 KB
patch
obsolete
>From c13b8d297706b516d88d4f527ed27fe30c8b2efa Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 6 Jun 2023 10:42:20 +0200 >Subject: [PATCH] Bug 33904: Fix 2FA registration when library name has > non-latin characters >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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> >--- > Koha/Auth/TwoFactorAuth.pm | 2 +- > Koha/REST/V1/TwoFactorAuth.pm | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/Auth/TwoFactorAuth.pm b/Koha/Auth/TwoFactorAuth.pm >index 5cd6d13ac7..6937ab9060 100644 >--- a/Koha/Auth/TwoFactorAuth.pm >+++ b/Koha/Auth/TwoFactorAuth.pm >@@ -75,7 +75,7 @@ sub new { > Koha::Exceptions::MissingParameter->throw("No secret passed or patron has no secret"); > } > >- my $issuer = $patron->library->branchname; >+ my $issuer = Encode::encode_utf8($patron->library->branchname); > my $key_id = sprintf "%s_%s", > $issuer, ( $patron->email || $patron->userid ); > >diff --git a/Koha/REST/V1/TwoFactorAuth.pm b/Koha/REST/V1/TwoFactorAuth.pm >index f9f199f74b..29679a544c 100644 >--- a/Koha/REST/V1/TwoFactorAuth.pm >+++ b/Koha/REST/V1/TwoFactorAuth.pm >@@ -98,8 +98,8 @@ sub registration { > { patron => $patron, secret => $secret } ); > > my $response = { >- issuer => $auth->issuer, >- key_id => $auth->key_id, >+ issuer => Encode::decode_utf8($auth->issuer), >+ key_id => Encode::decode_utf8($auth->key_id), > qr_code => $auth->qr_code, > secret32 => $auth->secret32, > >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33904
:
152038
|
152039
|
152196
|
152197
|
152198
|
152218
|
152219
|
152220