mirror of
https://github.com/elyby/accounts.git
synced 2024-12-23 13:50:06 +05:30
Добавлено экранирование # символа в QR коде
This commit is contained in:
parent
01850bb2d6
commit
013ddd1b1b
@ -22,7 +22,7 @@ class TwoFactorAuthInfo extends BaseAccountForm {
|
||||
$provisioningUri = $this->getTotp()->getProvisioningUri();
|
||||
|
||||
return [
|
||||
'qr' => 'data:image/svg+xml,' . trim($this->drawQrCode($provisioningUri)),
|
||||
'qr' => $this->buildDataImage($this->drawQrCode($provisioningUri)),
|
||||
'uri' => $provisioningUri,
|
||||
'secret' => $this->getAccount()->otp_secret,
|
||||
];
|
||||
@ -41,6 +41,14 @@ class TwoFactorAuthInfo extends BaseAccountForm {
|
||||
return $writer->writeString($content, Encoder::DEFAULT_BYTE_MODE_ECODING, ErrorCorrectionLevel::H);
|
||||
}
|
||||
|
||||
private function buildDataImage(string $svg) {
|
||||
$svg = trim($svg);
|
||||
// https://stackoverflow.com/a/30733736/5184751
|
||||
$svg = str_replace('#', '%23', $svg);
|
||||
|
||||
return 'data:image/svg+xml,' . $svg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $length
|
||||
* @throws ThisShouldNotHappenException
|
||||
|
Loading…
Reference in New Issue
Block a user