mirror of
https://github.com/elyby/accounts.git
synced 2024-12-28 08:00:25 +05:30
Теперь в поле qr запроса /api/two-factor-auth возвращается строка с svg без base64, начинающаяся с data:image/svg+xml,
This commit is contained in:
parent
c8db2f4b3f
commit
ec9da1709b
@ -63,7 +63,7 @@ class TwoFactorAuthForm extends ApiForm {
|
||||
$provisioningUri = $this->getTotp()->getProvisioningUri();
|
||||
|
||||
return [
|
||||
'qr' => base64_encode($this->drawQrCode($provisioningUri)),
|
||||
'qr' => 'data:image/svg+xml,' . htmlspecialchars(trim($this->drawQrCode($provisioningUri))),
|
||||
'uri' => $provisioningUri,
|
||||
'secret' => $this->account->otp_secret,
|
||||
];
|
||||
|
@ -35,7 +35,7 @@ class TwoFactorAuthFormTest extends TestCase {
|
||||
|
||||
$model->expects($this->once())
|
||||
->method('drawQrCode')
|
||||
->willReturn('this is qr code, trust me');
|
||||
->willReturn('<_/>');
|
||||
|
||||
$result = $model->getCredentials();
|
||||
$this->assertTrue(is_array($result));
|
||||
@ -44,7 +44,7 @@ class TwoFactorAuthFormTest extends TestCase {
|
||||
$this->assertArrayHasKey('secret', $result);
|
||||
$this->assertNotNull($account->otp_secret);
|
||||
$this->assertEquals($account->otp_secret, $result['secret']);
|
||||
$this->assertEquals(base64_encode('this is qr code, trust me'), $result['qr']);
|
||||
$this->assertEquals('data:image/svg+xml,<_/>', $result['qr']);
|
||||
|
||||
/** @var Account|\PHPUnit_Framework_MockObject_MockObject $account */
|
||||
$account = $this->getMockBuilder(Account::class)
|
||||
|
Loading…
Reference in New Issue
Block a user