From 622ea03c6531df069ac8a4ed056707b0f33d0e9b Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 8 Aug 2021 14:52:29 +0100 Subject: [PATCH] Added attribution for new libs added - Also hard-set TOTP algorithm with comment from testing others. --- app/Auth/Access/Mfa/TotpService.php | 5 +++++ readme.md | 4 +++- resources/views/users/edit.blade.php | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Auth/Access/Mfa/TotpService.php b/app/Auth/Access/Mfa/TotpService.php index f9a9f416e..d1013978b 100644 --- a/app/Auth/Access/Mfa/TotpService.php +++ b/app/Auth/Access/Mfa/TotpService.php @@ -9,6 +9,7 @@ use BaconQrCode\Renderer\RendererStyle\Fill; use BaconQrCode\Renderer\RendererStyle\RendererStyle; use BaconQrCode\Writer; use PragmaRX\Google2FA\Google2FA; +use PragmaRX\Google2FA\Support\Constants; class TotpService { @@ -17,6 +18,10 @@ class TotpService public function __construct(Google2FA $google2fa) { $this->google2fa = $google2fa; + // Use SHA1 as a default, Personal testing of other options in 2021 found + // many apps lack support for other algorithms yet still will scan + // the code causing a confusing UX. + $this->google2fa->setAlgorithm(Constants::SHA1); } /** diff --git a/readme.md b/readme.md index 1b8c66061..c0bef7c7a 100644 --- a/readme.md +++ b/readme.md @@ -189,4 +189,6 @@ These are the great open-source projects used to help build BookStack: * [OneLogin's SAML PHP Toolkit](https://github.com/onelogin/php-saml) * [League/CommonMark](https://commonmark.thephpleague.com/) * [League/Flysystem](https://flysystem.thephpleague.com) -* [StyleCI](https://styleci.io/) \ No newline at end of file +* [StyleCI](https://styleci.io/) +* [pragmarx/google2fa](https://github.com/antonioribeiro/google2fa) +* [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode) \ No newline at end of file diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index 4c733e6f6..d882558a4 100644 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -74,7 +74,6 @@ @icon('cancel') @endif {{ trans_choice('settings.users_mfa_x_methods', $mfaMethods->count()) }} - {{ $mfaMethods->count() }} {{ $mfaMethods->count() === 1 ? 'method' : 'methods' }} configured
@if($user->id === user()->id)