Refactor Security\Authentication class, remove dependency for App instance

This commit is contained in:
Art4 2024-11-06 13:21:57 +01:00
parent c0bd3b5ff0
commit 00d2e24dd2
8 changed files with 21 additions and 22 deletions

View file

@ -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 {

View file

@ -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) {