mirror of
https://github.com/elyby/accounts.git
synced 2024-12-02 11:41:05 +05:30
Рендерим SVG QR код без фиксации его размера, т.к. посчитать правильное разрешение в момент подготовки рендерера не известен размер матрицы
This commit is contained in:
parent
d07d5012bf
commit
9a852e8052
@ -38,7 +38,7 @@ class TwoFactorAuthForm extends ApiForm {
|
|||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rules() {
|
public function rules(): array {
|
||||||
$bothScenarios = [self::SCENARIO_ACTIVATE, self::SCENARIO_DISABLE];
|
$bothScenarios = [self::SCENARIO_ACTIVATE, self::SCENARIO_DISABLE];
|
||||||
return [
|
return [
|
||||||
['timestamp', 'integer', 'on' => [self::SCENARIO_ACTIVATE]],
|
['timestamp', 'integer', 'on' => [self::SCENARIO_ACTIVATE]],
|
||||||
@ -132,10 +132,8 @@ class TwoFactorAuthForm extends ApiForm {
|
|||||||
|
|
||||||
public function drawQrCode(string $content): string {
|
public function drawQrCode(string $content): string {
|
||||||
$renderer = new Svg();
|
$renderer = new Svg();
|
||||||
$renderer->setHeight(256);
|
|
||||||
$renderer->setWidth(256);
|
|
||||||
$renderer->setForegroundColor(new Rgb(32, 126, 92));
|
|
||||||
$renderer->setMargin(0);
|
$renderer->setMargin(0);
|
||||||
|
$renderer->setForegroundColor(new Rgb(32, 126, 92));
|
||||||
$renderer->addDecorator(new ElyDecorator());
|
$renderer->addDecorator(new ElyDecorator());
|
||||||
|
|
||||||
$writer = new Writer($renderer);
|
$writer = new Writer($renderer);
|
||||||
|
Loading…
Reference in New Issue
Block a user