Rezpkt
Member
- Affected version
- 2.2.3
If a user is logged in and they use the login link returned from /api/auth/login-token to log into a different account, they are still logged in as the old user.
I do not know if this has been overlooked or if it is by design, but I can't think of a reason to stop a user doing this.
In src/XF/Pub/Controller/Login.php actionApiToken() it is checking to see if the user is not logged in before doing the login.
I am suggesting that it should be possible to use an api-token to log into a different account if you are already logged in.
This then becomes
or the condition removed entirely
Thanks
I do not know if this has been overlooked or if it is by design, but I can't think of a reason to stop a user doing this.
In src/XF/Pub/Controller/Login.php actionApiToken() it is checking to see if the user is not logged in before doing the login.
PHP:
if (!\XF::visitor()->user_id)
{
/** @var \XF\ControllerPlugin\Login $loginPlugin */
$loginPlugin = $this->plugin('XF:Login');
$loginPlugin->completeLogin($token->User, $remember);
}
I am suggesting that it should be possible to use an api-token to log into a different account if you are already logged in.
This then becomes
PHP:
if (!\XF::visitor()->user_id || \XF::visitor()->user_id !== $token->user_id)
{
/** @var \XF\ControllerPlugin\Login $loginPlugin */
$loginPlugin = $this->plugin('XF:Login');
$loginPlugin->completeLogin($token->User, $remember);
}
or the condition removed entirely
Thanks
Last edited: