mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update SecuritySettings, remove imagick depdency for 2FA qr code generation image
This commit is contained in:
parent
aaf5b2764e
commit
506f95c6b1
2 changed files with 7 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<div class="card-body text-center">
|
||||
<div class="pb-3">
|
||||
<p class="font-weight-bold">QR Code</p>
|
||||
<img src="data:image/png;base64,{{$qrcode}}" class="img-fluid" width="200px">
|
||||
{!!$qrcode!!}
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-weight-bold">OTP Secret</p>
|
||||
|
|
Loading…
Reference in a new issue