-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- User remember_token is keeped when taking and leaving impersonation - Login and Logout events are not dispatched when impersonating
- Loading branch information
Showing
5 changed files
with
143 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Lab404\Impersonate\Guard; | ||
|
||
use Illuminate\Auth\SessionGuard as BaseSessionGuard; | ||
use Illuminate\Contracts\Auth\Authenticatable; | ||
|
||
class SessionGuard extends BaseSessionGuard | ||
{ | ||
/** | ||
* Log a user into the application without firing the Login event. | ||
* | ||
* @param \Illuminate\Contracts\Auth\Authenticatable $user | ||
* @return void | ||
*/ | ||
public function quietLogin(Authenticatable $user) | ||
{ | ||
$this->updateSession($user->getAuthIdentifier()); | ||
|
||
$this->setUser($user); | ||
} | ||
|
||
/** | ||
* Logout the user without updating remember_token | ||
* and without firing the Logout event. | ||
* | ||
* @param void | ||
* @return void | ||
*/ | ||
public function quietLogout() | ||
{ | ||
$this->clearUserDataFromStorage(); | ||
|
||
$this->user = null; | ||
|
||
$this->loggedOut = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters