mirror of
https://github.com/friendica/friendica
synced 2025-04-24 01:50:17 +00:00
Introduce new DI container
- Adding Friendica\DI class for getting dynamic classes - Replacing BaseObject::getApp() with this class
This commit is contained in:
parent
a9220aa83b
commit
1de3f186d7
132 changed files with 377 additions and 270 deletions
|
@ -7,6 +7,7 @@ use Friendica\App\Authentication;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\TwoFactor\RecoveryCode;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +33,7 @@ class Recovery extends BaseModule
|
|||
if (($_POST['action'] ?? '') == 'recover') {
|
||||
self::checkFormSecurityTokenRedirectOnError('2fa', 'twofactor_recovery');
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$recovery_code = $_POST['recovery_code'] ?? '';
|
||||
|
||||
|
@ -54,12 +55,12 @@ class Recovery extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
// Already authenticated with 2FA token
|
||||
if (Session::get('2fa')) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +29,7 @@ class Verify extends BaseModule
|
|||
if (($_POST['action'] ?? '') == 'verify') {
|
||||
self::checkFormSecurityTokenRedirectOnError('2fa', 'twofactor_verify');
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$code = $_POST['verify_code'] ?? '';
|
||||
|
||||
|
@ -51,12 +52,12 @@ class Verify extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
// Already authenticated with 2FA token
|
||||
if (Session::get('2fa')) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/verify.tpl'), [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue