Skip to content

Commit 3204495

Browse files
author
Carlos Garcia
committed
Replace Endroid QR code library with Chillerlan and add new translation keys for disabling two-factor authentication
1 parent c3660cc commit 3204495

26 files changed

+36
-11
lines changed

Core/Lib/TwoFactorManager.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919

2020
namespace FacturaScripts\Core\Lib;
2121

22-
use Endroid\QrCode\Color\Color;
23-
use Endroid\QrCode\QrCode;
24-
use Endroid\QrCode\Writer\PngWriter;
22+
use chillerlan\QRCode\QRCode;
23+
use chillerlan\QRCode\QROptions;
2524
use PragmaRX\Google2FA\Google2FA;
2625
use Exception;
2726
use FacturaScripts\Core\Tools;
@@ -83,14 +82,16 @@ public static function getQRCodeUrl(string $companyName, string $email, string $
8382
public static function getQRCodeImage(string $url): string
8483
{
8584
try {
86-
$qrCode = QrCode::create($url)
87-
->setSize(self::QR_CODE_SIZE)
88-
->setForegroundColor(new Color(0, 0, 0))
89-
->setBackgroundColor(new Color(255, 255, 255));
85+
$options = new QROptions([
86+
'version' => QRCode::VERSION_AUTO,
87+
'outputType' => QRCode::OUTPUT_IMAGE_PNG,
88+
'eccLevel' => QRCode::ECC_L,
89+
'scale' => 10,
90+
'imageBase64' => true,
91+
]);
9092

91-
$writer = new PngWriter();
92-
$result = $writer->write($qrCode);
93-
return $result->getDataUri();
93+
$qrcode = new QRCode($options);
94+
return $qrcode->render($url);
9495
} catch (Exception $e) {
9596
Tools::log()->error('error-generating-qr-code', [
9697
'%message%' => $e->getMessage(),

Core/Translation/ca_ES.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Provi de nou més tard",
16171617
"tuesday": "Dimarts",
16181618
"two-factor-auth": "Autenticació en 2 passos",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Autenticació en 2 passos desactivada",
16201621
"two-factor-auth-enable": "Activar l'autenticació en 2 passos",
16211622
"two-factor-auth-enabled": "Autenticació en 2 passos activada",

Core/Translation/cs_CZ.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Pruebe de nuevo más tarde",
16171617
"tuesday": "Martes",
16181618
"two-factor-auth": "2fázové ověření",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Dvoufázové ověření je deaktivováno",
16201621
"two-factor-auth-enable": "Aktivovat dvoufaktorové ověření",
16211622
"two-factor-auth-enabled": "Dvoufázové ověření je aktivováno",

Core/Translation/de_DE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Versuchen Sie es später erneut",
16171617
"tuesday": "Dienstag",
16181618
"two-factor-auth": "Zwei-Faktor-Authentifizierung",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Autenticación en 2 pasos desactivada",
16201621
"two-factor-auth-enable": "Activar autenticación en 2 pasos",
16211622
"two-factor-auth-enabled": "Autenticación en 2 pasos activada",

Core/Translation/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Try again later",
16171617
"tuesday": "Tuesday",
16181618
"two-factor-auth": "2-step authentication",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Two-factor authentication disabled",
16201621
"two-factor-auth-enable": "Activar autenticación en 2 pasos",
16211622
"two-factor-auth-enabled": "Two-factor authentication enabled",

Core/Translation/es_AR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Pruebe de nuevo más tarde",
16171617
"tuesday": "Martes",
16181618
"two-factor-auth": "Autenticación en 2 pasos",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Autenticación en 2 pasos desactivada",
16201621
"two-factor-auth-enable": "Activar autenticación en 2 pasos",
16211622
"two-factor-auth-enabled": "Autenticación en 2 pasos activada",

Core/Translation/es_CL.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Pruebe de nuevo más tarde",
16171617
"tuesday": "Martes",
16181618
"two-factor-auth": "Autenticación en 2 pasos",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Autenticación en 2 pasos desactivada",
16201621
"two-factor-auth-enable": "Activar autenticación en 2 pasos",
16211622
"two-factor-auth-enabled": "Autenticación en 2 pasos activada",

Core/Translation/es_CO.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Pruebe de nuevo más tarde",
16171617
"tuesday": "Martes",
16181618
"two-factor-auth": "Autenticación en 2 pasos",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Autenticación en 2 pasos desactivada",
16201621
"two-factor-auth-enable": "Activar autenticación en 2 pasos",
16211622
"two-factor-auth-enabled": "Autenticación en 2 pasos activada",

Core/Translation/es_CR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Pruebe de nuevo más tarde",
16171617
"tuesday": "Martes",
16181618
"two-factor-auth": "Autenticación en 2 pasos",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Autenticación en 2 pasos desactivada",
16201621
"two-factor-auth-enable": "Activar autenticación en 2 pasos",
16211622
"two-factor-auth-enabled": "Autenticación en 2 pasos activada",

Core/Translation/es_DO.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@
16161616
"try-again-later": "Pruebe de nuevo más tarde",
16171617
"tuesday": "Martes",
16181618
"two-factor-auth": "Autenticación en 2 pasos",
1619+
"two-factor-auth-disable": "Desactivar autenticación en 2 pasos",
16191620
"two-factor-auth-disabled": "Autenticación en 2 pasos desactivada",
16201621
"two-factor-auth-enable": "Activar autenticación en 2 pasos",
16211622
"two-factor-auth-enabled": "Autenticación en 2 pasos activada",

0 commit comments

Comments
 (0)