mirror of
https://github.com/friendica/friendica
synced 2025-04-25 07:50:10 +00:00
Refactor Security\Authentication class, remove dependency for App instance
This commit is contained in:
parent
c0bd3b5ff0
commit
00d2e24dd2
8 changed files with 21 additions and 22 deletions
|
@ -76,7 +76,6 @@ class Login extends BaseModule
|
|||
|
||||
if (!empty($request['auth-params']) && $request['auth-params'] === 'login') {
|
||||
$this->auth->withPassword(
|
||||
DI::app(),
|
||||
trim($request['username']),
|
||||
trim($request['password']),
|
||||
!empty($request['remember']),
|
||||
|
|
|
@ -57,7 +57,7 @@ class OpenID extends BaseModule
|
|||
// successful OpenID login
|
||||
$session->remove('openid');
|
||||
|
||||
DI::auth()->setForUser(DI::app(), $user, true, true);
|
||||
DI::auth()->setForUser($user, true, true);
|
||||
|
||||
$this->baseUrl->redirect(DI::session()->pop('return_path', ''));
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class Recovery extends BaseModule
|
|||
$this->session->set('2fa', true);
|
||||
DI::sysmsg()->addInfo($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser($this->session->getLocalUserId())));
|
||||
|
||||
$this->auth->setForUser($this->app, User::getById($this->session->getLocalUserId()), true, true);
|
||||
$this->auth->setForUser(User::getById($this->session->getLocalUserId()), true, true);
|
||||
|
||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||
} else {
|
||||
|
|
|
@ -88,7 +88,7 @@ class Trust extends BaseModule
|
|||
}
|
||||
|
||||
try {
|
||||
$this->auth->setForUser($this->app, User::getById($this->session->getLocalUserId()), true, true);
|
||||
$this->auth->setForUser(User::getById($this->session->getLocalUserId()), true, true);
|
||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||
} catch (FoundException | TemporaryRedirectException | MovedPermanentlyException $e) {
|
||||
// exception wanted!
|
||||
|
@ -109,7 +109,7 @@ class Trust extends BaseModule
|
|||
try {
|
||||
$trustedBrowser = $this->trustedBrowserRepository->selectOneByHash($this->cookie->get('2fa_cookie_hash'));
|
||||
if (!$trustedBrowser->trusted) {
|
||||
$this->auth->setForUser($this->app, User::getById($this->session->getLocalUserId()), true, true);
|
||||
$this->auth->setForUser(User::getById($this->session->getLocalUserId()), true, true);
|
||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||
}
|
||||
} catch (TrustedBrowserNotFoundException $exception) {
|
||||
|
|
|
@ -120,7 +120,7 @@ class Delegation extends BaseModule
|
|||
|
||||
$this->session->clear();
|
||||
|
||||
$this->auth->setForUser($this->app, $user, true, true);
|
||||
$this->auth->setForUser($user, true, true);
|
||||
|
||||
if ($limited_id) {
|
||||
$this->session->setSubManagedUserId($original_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue