Two Factor Authentication

Adds an extra layer of security to the October CMS backend.

Back to Two Factor Authentication Support

chocolata
chocolata

Hi guys,

After updating to the last version, the back-end administration area becomes unavailable and shows a 500 error. In the logs, the following error is shown:

Symfony\Component\Debug\Exception\FatalThrowableError: Parse error: syntax error, unexpected 'Request' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in 
/var/www/vhosts/mydomain.com/httpdocs/plugins/vdlp/twofactorauthentication/classes/eventlisteners/backend/PageBeforeDisplay.php:19

Could you kindly let me know what could be the problem?

Thanks.

VDLP
VDLP

Check your PHP version, as mentioned in the release notes major version 3.0.0 will only support PHP 7.4 or higher.

chocolata
chocolata

Hi, thanks! I'm an idiot :-)

The problem is that when I switch to PHP7.4.21, the whole site throws an error... See the stack trace below. October CMS should support PHP7.4.21, right? I didn't switch over to October CMS 2.0.

Do you have an idea what would be wrong there?

2021-07-30 15:38:15 Error   XX.XXX.100.222  500 GET / HTTP/1.0      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 460 Apache SSL/TLS access
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Call to a member function connection() on null in /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1138                Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: Stack trace:             Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #0 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1104): Illuminate\\Database\\Eloquent\\Model::resolveConnection()               Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #1 /var/www/vhosts/mydomain.com/httpdocs/vendor/october/rain/src/Database/Model.php(599): Illuminate\\Database\\Eloquent\\Model->getConnection()             Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #2 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(847): October\\Rain\\Database\\Model->newBaseQueryBuilder()             Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #3 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(885): Illuminate\\Database\\Eloquent\\Model->newModelQuery()                Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #4 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(836): Illuminate\\Database\\Eloquent\\Model->newQueryWithoutScopes()                Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #5 /var/www/ in /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 1138               Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Call to a member function connection() on null in /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1138                Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: Stack trace:             Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #0 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1104): Illuminate\\Database\\Eloquent\\Model::resolveConnection()               Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #1 /var/www/vhosts/mydomain.com/httpdocs/vendor/october/rain/src/Database/Model.php(599): Illuminate\\Database\\Eloquent\\Model->getConnection()             Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #2 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(847): October\\Rain\\Database\\Model->newBaseQueryBuilder()             Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #3 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(885): Illuminate\\Database\\Eloquent\\Model->newModelQuery()                Apache error
2021-07-30 15:38:15 Warning XX.XXX.100.222      mod_fcgid: stderr: #4 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(836): Illuminate\\Database\\Eloquent\\Model->newQueryWithoutScopes()                Apache error
VDLP
VDLP

October CMS 1.1 does support PHP 7.4 indeed. If you are experiencing issues with PHP 7.4 I would advice you to stay at version 2.0 of the 2FA plugin for the time being. And resolve the issues on your hosting environment.

chocolata
chocolata

Hi, I want to come back to this issue. I've now got my setup up and running in PHP7.4.23 but I'm still encountering issues with version 3.0.0 of the twofactorauthentication plugin. I'm encountering server errors, with the following stack trace.

Could you kindly help look for a solution? Thanks in advance.

Symfony\Component\Debug\Exception\FatalThrowableError: Class 'PragmaRX\Google2FA\Google2FA' not found in /var/www/vhosts/mydomain.com/httpdocs/plugins/vdlp/twofactorauthentication/ServiceProvider.php:32
Stack trace:
#0 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(749): Vdlp\TwoFactorAuthentication\ServiceProvider->Vdlp\TwoFactorAuthentication\{closure}()
#1 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build()
#2 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(586): Illuminate\Container\Container->resolve()
#3 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(732): Illuminate\Container\Container->make()
#4 /var/www/vhosts/mydomain.com/httpdocs/vendor/october/rain/src/Foundation/Application.php(188): Illuminate\Foundation\Application->make()
#5 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(885): October\Rain\Foundation\Application->make()
#6 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(813): Illuminate\Container\Container->resolveClass()
#7 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(780): Illuminate\Container\Container->resolveDependencies()
#8 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build()
#9 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Container/Container.php(586): Illuminate\Container\Container->resolve()
#10 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(732): Illuminate\Container\Container->make()
#11 /var/www/vhosts/mydomain.com/httpdocs/vendor/october/rain/src/Foundation/Application.php(188): Illuminate\Foundation\Application->make()
#12 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): October\Rain\Foundation\Application->make()
#13 /var/www/vhosts/mydomain.com/httpdocs/modules/backend/classes/BackendController.php(269): Illuminate\Support\Facades\Facade::__callStatic()
#14 /var/www/vhosts/mydomain.com/httpdocs/modules/backend/classes/BackendController.php(227): Backend\Classes\BackendController->findController()
#15 /var/www/vhosts/mydomain.com/httpdocs/modules/backend/classes/BackendController.php(79): Backend\Classes\BackendController->getRequestedController()
#16 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(131): Backend\Classes\BackendController->Backend\Classes\{closure}()
#17 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#18 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#19 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#20 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#21 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#22 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#23 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#25 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Session\Middleware\StartSession->handle()
#26 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#27 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#28 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#29 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(68): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#31 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#32 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#33 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#34 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(660): Illuminate\Pipeline\Pipeline->then()
#35 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->runRouteWithinStack()
#36 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(601): Illuminate\Routing\Router->runRoute()
#37 /var/www/vhosts/mydomain.com/httpdocs/vendor/october/rain/src/Router/CoreRouter.php(20): Illuminate\Routing\Router->dispatchToRoute()
#38 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): October\Rain\Router\CoreRouter->dispatch()
#39 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#40 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#41 /var/www/vhosts/mydomain.com/httpdocs/vendor/october/rain/src/Foundation/Http/Middleware/CheckForMaintenanceMode.php(25): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()
#42 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()
#43 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#44 /var/www/vhosts/mydomain.com/httpdocs/vendor/october/rain/src/Http/Middleware/TrustHosts.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#45 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): October\Rain\Http\Middleware\TrustHosts->handle()
#46 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#47 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#48 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then()
#49 /var/www/vhosts/mydomain.com/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#50 /var/www/vhosts/mydomain.com/httpdocs/index.php(43): Illuminate\Foundation\Http\Kernel->handle()
#51 {main}
VDLP
VDLP

It seems that you don't have installed the required dependencies for the plugin. Depending on the way you installed the plugin you need to update your projects' dependencies (composer update).

1-6 of 6