Skip to content

Commit

Permalink
Merge pull request #680 from systemli/fix/qrcode
Browse files Browse the repository at this point in the history
fix: migrate to new endroid/qr-code API
  • Loading branch information
doobry-systemli authored Dec 1, 2024
2 parents 049b3dd + b4690b4 commit c073f91
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/Controller/TwofactorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down

0 comments on commit c073f91

Please sign in to comment.