Browse Source

fix logout bug

CauseFX 5 years ago
parent
commit
09b1d42faf
1 changed files with 22 additions and 11 deletions
  1. 22 11
      api/classes/organizr.class.php

+ 22 - 11
api/classes/organizr.class.php

@@ -3049,18 +3049,29 @@ class Organizr
 		}
 	}
 	
-	public function revokeTokenCurrentUser($token)
+	public function revokeTokenCurrentUser($token = null)
 	{
-		$response = [
-			array(
-				'function' => 'query',
-				'query' => array(
-					'DELETE FROM tokens WHERE user_id = ? or token = ?',
-					[$this->user['userID']],
-					[$token]
-				)
-			),
-		];
+		if ($token) {
+			$response = [
+				array(
+					'function' => 'query',
+					'query' => array(
+						'DELETE FROM tokens WHERE token = ?',
+						[$token]
+					)
+				),
+			];
+		} else {
+			$response = [
+				array(
+					'function' => 'query',
+					'query' => array(
+						'DELETE FROM tokens WHERE user_id = ?',
+						[$this->user['userID']]
+					)
+				),
+			];
+		}
 		return $this->processQueries($response);
 	}