mirror of
https://github.com/friendica/friendica
synced 2025-04-24 01:50:17 +00:00
Rework return_path session key handling
- Add new IHandleSessions::pop() method - Remove redirection from Authentication::setForUser() - Add explicit return_path form parameter to Login::form()
This commit is contained in:
parent
64894f9d6f
commit
067f06b166
8 changed files with 102 additions and 60 deletions
|
@ -73,6 +73,8 @@ class Recovery extends BaseModule
|
|||
info($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user())));
|
||||
|
||||
$this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
|
||||
|
||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||
} else {
|
||||
notice($this->t('Invalid code, please retry.'));
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ class Trust extends BaseModule
|
|||
|
||||
try {
|
||||
$this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
|
||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||
} catch (FoundException | TemporaryRedirectException | MovedPermanentlyException $e) {
|
||||
// exception wanted!
|
||||
throw $e;
|
||||
|
@ -122,7 +123,7 @@ class Trust extends BaseModule
|
|||
$trustedBrowser = $this->trustedBrowserRepository->selectOneByHash($this->cookie->get('2fa_cookie_hash'));
|
||||
if (!$trustedBrowser->trusted) {
|
||||
$this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
|
||||
$this->baseUrl->redirect();
|
||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||
}
|
||||
} catch (TrustedBrowserNotFoundException $exception) {
|
||||
$this->logger->notice('Trusted Browser of the cookie not found.', ['cookie_hash' => $this->cookie->get('trusted'), 'uid' => $this->app->getLoggedInUserId(), 'exception' => $exception]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue