Browse Source

Added plex token to DB
Added plex machine ID to active info

causefx 7 years ago
parent
commit
a5f3376b80
2 changed files with 11 additions and 0 deletions
  1. 10 0
      api/functions/api-functions.php
  2. 1 0
      api/functions/organizr-functions.php

+ 10 - 0
api/functions/api-functions.php

@@ -70,6 +70,16 @@ function login($array)
                     	WHERE id=?', $result['id']);
 					writeLog('success', 'Login Function - User Password updated from backend', $username);
 				}
+				if ($token !== '') {
+					if ($token !== $result['plex_token']) {
+						$database->query('
+	                        UPDATE users SET', [
+							'plex_token' => $token
+						], '
+	                        WHERE id=?', $result['id']);
+						writeLog('success', 'Login Function - User Plex Token updated from backend', $username);
+					}
+				}
 				// 2FA might go here
 				if ($result['auth_service'] !== 'internal' && strpos($result['auth_service'], '::') !== false) {
 					$TFA = explode('::', $result['auth_service']);

+ 1 - 0
api/functions/organizr-functions.php

@@ -30,6 +30,7 @@ function organizrSpecialSettings()
 			'plex' => array(
 				'enabled' => ($GLOBALS['ssoPlex']) ? true : false,
 				'cookie' => isset($_COOKIE['mpt']) ? true : false,
+				'machineID' => $GLOBALS['plexID'],
 			),
 			'ombi' => array(
 				'enabled' => ($GLOBALS['ssoOmbi']) ? true : false,