Skip to content

Commit

Permalink
Non ajax now redirects back to the correct page
Browse files Browse the repository at this point in the history
  • Loading branch information
Flerex committed May 31, 2020
1 parent 7cdaefc commit 6415b58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion controller/switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public function handle(int $account_id)
*/
private function get_session_page(): string
{

$session_page = $this->user->data['session_page'];
$rewrite_helper = 'app.php/';
$len = strlen($rewrite_helper);
Expand Down
12 changes: 8 additions & 4 deletions service/linking_service.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class linking_service
/**
* Constructor
*
* @param user $user
* @param config $config
* @param db $db
* @param string $linkedaccounts_table
* @param user $user
* @param config $config
* @param db $db
* @param string $linkedaccounts_table
*/
public function __construct(user $user, config $config, db $db, string $linkedaccounts_table)
{
Expand Down Expand Up @@ -341,9 +341,13 @@ public function switch_to_linked_account(int $account_id): void
? (bool) $this->user->data['session_admin']
: false;

$session_page = $this->user->data['session_page']; // We retrieve the current page before switching users

$this->user->session_kill(false);
$this->user->session_begin();
$this->user->session_create($account_id, $preserve_admin_login, $session_autologin, $session_viewonline);
$this->user->update_session(compact('session_page'));
$this->user->data['session_page'] = $session_page;
}

}

0 comments on commit 6415b58

Please sign in to comment.