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>
This commit is contained in:
parent
dfed7f235d
commit
deeb5ebdbd
2 changed files with 3 additions and 3 deletions
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
Loading…
Reference in a new issue