mirror of
git://f0xx.org/ac/ac-ms-identity
synced 2026-07-30 02:37:39 +03:00
Use server-side branded QR data URIs for TOTP fallback images.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,12 @@ final class AuthTotp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function qrImageUrl(string $otpauthUri, int $size = 200): string {
|
public static function qrImageUrl(string $otpauthUri, int $size = 200): string {
|
||||||
|
if (class_exists('QrBrandedRenderer', false)) {
|
||||||
|
$dataUri = QrBrandedRenderer::dataUri($otpauthUri, $size);
|
||||||
|
if ($dataUri !== null) {
|
||||||
|
return $dataUri;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 'https://api.qrserver.com/v1/create-qr-code/?size=' . $size . 'x' . $size
|
return 'https://api.qrserver.com/v1/create-qr-code/?size=' . $size . 'x' . $size
|
||||||
. '&data=' . rawurlencode($otpauthUri);
|
. '&data=' . rawurlencode($otpauthUri);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user