mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 16:14:26 +02:00
Make BaseModule
a real entity
- Add all dependencies, necessary to run the content (baseUrl, Arguments) - Encapsulate all POST/GET/DELETE/PATCH/PUT methods as protected methods inside the BaseModule - Return Module content ONLY per `BaseModule::run()` (including the Hook logic there as well)
This commit is contained in:
parent
238613fd01
commit
8bdd90066f
252 changed files with 615 additions and 623 deletions
|
@ -33,7 +33,7 @@ use Friendica\Module\Register;
|
|||
*/
|
||||
class Login extends BaseModule
|
||||
{
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
$return_path = $_REQUEST['return_path'] ?? '' ;
|
||||
|
||||
|
@ -46,7 +46,7 @@ class Login extends BaseModule
|
|||
return self::form(Session::get('return_path'), intval(DI::config()->get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
|
||||
}
|
||||
|
||||
public function post()
|
||||
protected function post(array $request = [], array $post = [])
|
||||
{
|
||||
$return_path = Session::get('return_path');
|
||||
Session::clear();
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace Friendica\Module\Security;
|
||||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Cache\Capability\ICanCache;
|
||||
use Friendica\Core\Hook;
|
||||
|
@ -31,6 +31,8 @@ use Friendica\Core\System;
|
|||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use Friendica\Security\TwoFactor;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Logout module
|
||||
|
@ -43,19 +45,16 @@ class Logout extends BaseModule
|
|||
protected $cookie;
|
||||
/** @var IHandleSessions */
|
||||
protected $session;
|
||||
/** @var BaseURL */
|
||||
protected $baseUrl;
|
||||
/** @var TwoFactor\Repository\TrustedBrowser */
|
||||
protected $trustedBrowserRepo;
|
||||
|
||||
public function __construct(TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, ICanCache $cache, Cookie $cookie, IHandleSessions $session, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
|
||||
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, ICanCache $cache, Cookie $cookie, IHandleSessions $session, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $parameters);
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
|
||||
|
||||
$this->cache = $cache;
|
||||
$this->cookie = $cookie;
|
||||
$this->session = $session;
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->trustedBrowserRepo = $trustedBrowserRepo;
|
||||
}
|
||||
|
||||
|
@ -63,7 +62,7 @@ class Logout extends BaseModule
|
|||
/**
|
||||
* Process logout requests
|
||||
*/
|
||||
public function rawContent()
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
$visitor_home = null;
|
||||
if (remote_user()) {
|
||||
|
|
|
@ -31,7 +31,7 @@ use LightOpenID;
|
|||
*/
|
||||
class OpenID extends BaseModule
|
||||
{
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (DI::config()->get('system', 'no_openid')) {
|
||||
DI::baseUrl()->redirect();
|
||||
|
|
|
@ -29,6 +29,8 @@ use Friendica\Core\Session\Capability\IHandleSessions;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Security\Authentication;
|
||||
use Friendica\Security\TwoFactor\Model\RecoveryCode;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* // Page 1a: Recovery code verification
|
||||
|
@ -41,22 +43,19 @@ class Recovery extends BaseModule
|
|||
protected $session;
|
||||
/** @var App */
|
||||
protected $app;
|
||||
/** @var App\BaseURL */
|
||||
protected $baseUrl;
|
||||
/** @var Authentication */
|
||||
protected $auth;
|
||||
|
||||
public function __construct(App $app, App\BaseURL $baseUrl, Authentication $auth, IHandleSessions $session, L10n $l10n, array $parameters = [])
|
||||
public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Authentication $auth, IHandleSessions $session, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $parameters);
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
|
||||
|
||||
$this->app = $app;
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->auth = $auth;
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
public function post()
|
||||
protected function post(array $request = [], array $post = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
|
@ -79,7 +78,7 @@ class Recovery extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
$this->baseUrl->redirect();
|
||||
|
|
|
@ -38,7 +38,7 @@ class Verify extends BaseModule
|
|||
{
|
||||
private static $errors = [];
|
||||
|
||||
public function post()
|
||||
protected function post(array $request = [], array $post = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
|
@ -78,7 +78,7 @@ class Verify extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
DI::baseUrl()->redirect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue