From 506f95c6b1aa6c067efbe84df1bde3d44125f999 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 26 Apr 2023 02:34:44 -0600 Subject: [PATCH] Update SecuritySettings, remove imagick depdency for 2FA qr code generation image --- app/Http/Controllers/Settings/SecuritySettings.php | 10 ++++++---- resources/views/settings/security/2fa/setup.blade.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Settings/SecuritySettings.php b/app/Http/Controllers/Settings/SecuritySettings.php index 1acb96078..604a1e90b 100644 --- a/app/Http/Controllers/Settings/SecuritySettings.php +++ b/app/Http/Controllers/Settings/SecuritySettings.php @@ -16,7 +16,7 @@ use Carbon\Carbon; use Illuminate\Http\Request; use PragmaRX\Google2FA\Google2FA; use BaconQrCode\Renderer\ImageRenderer; -use BaconQrCode\Renderer\Image\ImagickImageBackEnd; +use BaconQrCode\Renderer\Image\SvgImageBackEnd; use BaconQrCode\Renderer\RendererStyle\RendererStyle; use BaconQrCode\Writer; @@ -56,13 +56,15 @@ trait SecuritySettings $key, 500 ); + + $writer = new Writer( new ImageRenderer( new RendererStyle(400), - new ImagickImageBackEnd() + new SvgImageBackEnd() ) ); - $qrcode = base64_encode($writer->writeString($qrcode)); + $qrcode = $writer->writeString($qrcode); $user->{'2fa_secret'} = $key; $user->{'2fa_backup_codes'} = json_encode($backups); $user->save(); @@ -162,4 +164,4 @@ trait SecuritySettings 'msg' => 'Successfully removed 2fa device' ], 200); } -} \ No newline at end of file +} diff --git a/resources/views/settings/security/2fa/setup.blade.php b/resources/views/settings/security/2fa/setup.blade.php index 39e83a9c6..1ac247d59 100644 --- a/resources/views/settings/security/2fa/setup.blade.php +++ b/resources/views/settings/security/2fa/setup.blade.php @@ -50,7 +50,7 @@

QR Code

- + {!!$qrcode!!}

OTP Secret