fix: handle Logto data URI in MFA QR code display
All checks were successful
CI / build (push) Successful in 2m7s
CI / docker (push) Successful in 1m31s
CI / build (pull_request) Successful in 3m23s
CI / docker (pull_request) Has been skipped

Logto's secretQrCode is a data:image/png;base64 URI, not an otpauth://
string. QRCodeSVG crashes trying to encode it ("Data too long"). Now
renders data URIs as <img> and only uses QRCodeSVG for otpauth:// URIs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-27 15:43:39 +02:00
parent 15d6c7abc1
commit ab800bbef9

View File

@@ -162,7 +162,11 @@ export function MfaSection() {
Scan this QR code with your authenticator app (Google Authenticator, Authy, 1Password, etc.), then enter the 6-digit code below.
</p>
<div style={{ display: 'flex', justifyContent: 'center', padding: '16px 0' }}>
<QRCodeSVG value={setupData.secretQrCode} size={200} />
{setupData.secretQrCode.startsWith('data:') ? (
<img src={setupData.secretQrCode} alt="TOTP QR Code" width={200} height={200} />
) : (
<QRCodeSVG value={setupData.secretQrCode} size={200} />
)}
</div>
<div style={{
textAlign: 'center',