1
0
mirror of git://f0xx.org/ac/ac-ms-identity synced 2026-07-30 02:37:39 +03:00

auth: fix verify-email shorten guard; derive QR image URL from slug

Use is_callable for ShortLinksRepository; build qr image URL when pack
only has short_url (stale seed compatibility).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-06-23 19:08:41 +02:00
parent 290109d0f1
commit 035bed7512

View File

@@ -29,10 +29,17 @@ final class AuthMailer {
$subject = 'Verify your Android Cast account';
$shortUrl = $verifyUrl;
$qrImageUrl = null;
if (class_exists('ShortLinksRepository', false)) {
if (is_callable(['ShortLinksRepository', 'shortenForOutboundMail'])) {
$pack = ShortLinksRepository::shortenForOutboundMail($verifyUrl, 86400);
$shortUrl = (string) ($pack['short_url'] ?? $verifyUrl);
$qrImageUrl = (string) ($pack['qr_image_url'] ?? '');
if ($qrImageUrl === '' && preg_match('#/([a-f0-9]{6,16})$#', $shortUrl, $m)) {
$qrImageUrl = preg_replace(
'#/([a-f0-9]{6,16})$#',
'/api/v1/qr/' . $m[1] . '.png',
$shortUrl
);
}
if ($qrImageUrl === '') {
$qrImageUrl = null;
}