From b4690b466cfbf3059c84907151798b71f0e839ee Mon Sep 17 00:00:00 2001 From: doobry Date: Sun, 1 Dec 2024 00:01:33 +0100 Subject: [PATCH] fix: migrate to new endroid/qr-code API --- src/Controller/TwofactorController.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Controller/TwofactorController.php b/src/Controller/TwofactorController.php index 635bb2cd..0f473d4c 100644 --- a/src/Controller/TwofactorController.php +++ b/src/Controller/TwofactorController.php @@ -312,16 +312,17 @@ public function displayTotpQrCode(TotpAuthenticatorInterface $totpAuthenticator) throw new NotFoundHttpException('Cannot display QR code'); } - $result = Builder::create() - ->writer(new PngWriter()) - ->writerOptions([]) - ->data($totpAuthenticator->getQRContent($user)) - ->encoding(new Encoding('UTF-8')) - ->errorCorrectionLevel(ErrorCorrectionLevel::High) - ->size(320) - ->margin(20) - ->roundBlockSizeMode(RoundBlockSizeMode::Margin) - ->build(); + $builder = new Builder( + writer: new PngWriter(), + writerOptions: [], + data: $totpAuthenticator->getQRContent($user), + encoding: new Encoding('UTF-8'), + errorCorrectionLevel: ErrorCorrectionLevel::High, + size: 320, + margin: 20, + roundBlockSizeMode: RoundBlockSizeMode::Margin, + ); + $result = $builder->build(); return new Response($result->getString(), Response::HTTP_OK, ['Content-Type' => 'image/png']); }