Example #1
0
 /**
  * Function for user to log-out from all the devices at once.
  * @param string $userID    The user ID that needs to log out from all devices
  */
 public static function logOutFromAllDevices($userID)
 {
     SQL("DELETE FROM `AUTH_TOKEN` WHERE USERID = ?", array($userID));
     if (file_exists(__DIR__ . "/../session/session.php")) {
         require_once __DIR__ . "/../session/session.php";
         //If session library is present, then delete all sessions from the server as well as user's browser
         Session::destroyAllSessions($userID);
     }
 }
Example #2
0
 /**
  * Function to check if all sessions can be destroyed for the current user.
  */
 public function testDestroyAllSessions()
 {
     //destroy all sessions
     Session::destroyAllSessions($this->session[0]->getUserID());
     //try to get all sessions. Must return FALSE since no records were found
     $allSessions = Session::getAllSessions($this->session[0]->getUserID());
     $this->assertFalse($allSessions);
 }