UserSession class [5] - Refactor src/Module/ files with DI
This commit is contained in:
parent
a729f3255d
commit
eecc456e0c
78 changed files with 455 additions and 530 deletions
|
@ -25,7 +25,6 @@ use Friendica\App;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -53,11 +52,11 @@ class Trusted extends BaseSettings
|
|||
$this->pConfig = $pConfig;
|
||||
$this->trustedBrowserRepo = $trustedBrowserRepo;
|
||||
|
||||
if (!Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$verified = $this->pConfig->get(Session::getLocalUser(), '2fa', 'verified');
|
||||
$verified = $this->pConfig->get(DI::userSession()->getLocalUserId(), '2fa', 'verified');
|
||||
|
||||
if (!$verified) {
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
|
@ -71,7 +70,7 @@ class Trusted extends BaseSettings
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
if (!Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,7 +79,7 @@ class Trusted extends BaseSettings
|
|||
|
||||
switch ($_POST['action']) {
|
||||
case 'remove_all':
|
||||
$this->trustedBrowserRepo->removeAllForUser(Session::getLocalUser());
|
||||
$this->trustedBrowserRepo->removeAllForUser(DI::userSession()->getLocalUserId());
|
||||
DI::sysmsg()->addInfo($this->t('Trusted browsers successfully removed.'));
|
||||
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
break;
|
||||
|
@ -90,7 +89,7 @@ class Trusted extends BaseSettings
|
|||
if (!empty($_POST['remove_id'])) {
|
||||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
|
||||
|
||||
if ($this->trustedBrowserRepo->removeForUser(Session::getLocalUser(), $_POST['remove_id'])) {
|
||||
if ($this->trustedBrowserRepo->removeForUser(DI::userSession()->getLocalUserId(), $_POST['remove_id'])) {
|
||||
DI::sysmsg()->addInfo($this->t('Trusted browser successfully removed.'));
|
||||
}
|
||||
|
||||
|
@ -103,7 +102,7 @@ class Trusted extends BaseSettings
|
|||
{
|
||||
parent::content();
|
||||
|
||||
$trustedBrowsers = $this->trustedBrowserRepo->selectAllByUid(Session::getLocalUser());
|
||||
$trustedBrowsers = $this->trustedBrowserRepo->selectAllByUid(DI::userSession()->getLocalUserId());
|
||||
|
||||
$parser = Parser::create();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue