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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user