1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-07-10 19:16:22 +02:00

Implement method 'logOutEverywhere' in class 'Auth'

This commit is contained in:
Marco
2018-03-25 00:28:21 +01:00
parent 58f1f34593
commit 3ae1769256

View File

@ -412,6 +412,23 @@ final class Auth extends UserManager {
}
}
/**
* Logs the user out in all sessions
*
* @throws NotLoggedInException if the user is not currently signed in
* @throws AuthError if an internal problem occurred (do *not* catch)
*/
public function logOutEverywhere() {
if (!$this->isLoggedIn()) {
throw new NotLoggedInException();
}
// schedule a forced logout in all sessions
$this->forceLogoutForUserById($this->getUserId());
// and immediately apply the logout locally
$this->logOut();
}
/**
* Destroys all session data
*