mirror of
https://github.com/friendica/friendica
synced 2025-04-22 13:50:12 +00:00
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\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
|
@ -60,7 +59,7 @@ class Recovery extends BaseModule
|
|||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
if (!Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,10 +68,10 @@ class Recovery extends BaseModule
|
|||
|
||||
$recovery_code = $_POST['recovery_code'] ?? '';
|
||||
|
||||
if (RecoveryCode::existsForUser(Session::getLocalUser(), $recovery_code)) {
|
||||
RecoveryCode::markUsedForUser(Session::getLocalUser(), $recovery_code);
|
||||
if (RecoveryCode::existsForUser(DI::userSession()->getLocalUserId(), $recovery_code)) {
|
||||
RecoveryCode::markUsedForUser(DI::userSession()->getLocalUserId(), $recovery_code);
|
||||
$this->session->set('2fa', true);
|
||||
DI::sysmsg()->addInfo($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(Session::getLocalUser())));
|
||||
DI::sysmsg()->addInfo($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(DI::userSession()->getLocalUserId())));
|
||||
|
||||
$this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
|
||||
|
||||
|
@ -85,7 +84,7 @@ class Recovery extends BaseModule
|
|||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!Session::getLocalUser()) {
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue