Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear session on impersonation exception #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

erikn69
Copy link
Contributor

@erikn69 erikn69 commented Feb 28, 2024

When quietLogout doesn't exists, take returns false, but session keeps impersonated_by, this causes the app to behave as if it is being impersonated to another user when in reality that is not the case
When quietLogin doesn't exists, take returns false but current user already be logout, and no user is logged in

session()->put($this->getSessionKey(), $from->getAuthIdentifier());
session()->put($this->getSessionGuard(), $currentGuard);
session()->put($this->getSessionGuardUsing(), $guardName);
$this->app['auth']->guard($currentGuard)->quietLogout();
$this->app['auth']->guard($guardName)->quietLogin($to);
} catch (\Exception $e) {
unset($e);
return false;

public function isImpersonating(): bool
{
return session()->has($this->getSessionKey());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant