瀏覽代碼

Fix username in overseerr SSO logs

Username was being reported as Guest, this is to report the correct username in the logs, was receiving null value from $user['username'] as Plex usernames from Overseerr API uses $user['plexUsername']

Example;

````
/api/v1/auth/plex

{
    "permissions": 2,
    "id": 1,
    "plexUsername": "Username",
    "username": null,
    "recoveryLinkExpirationDate": null,
    "userType": 1,
    "avatar": "https://plex.tv/users/dgerrgrdg/avatar?c=5841564",
    "createdAt": "2021-02-23T22:27:44.000Z",
    "updatedAt": "2021-02-24T13:23:53.000Z",
    "settings": null,
    "requestCount": 1,
    "displayName": "Username",
    "plexToken": "Token",
    "password": null,
    "resetPasswordGuid": null,
    "plexId": null
}
````

Not sure if the intention is to keep the username being reported back from Overseerr, would make sense to make sure that the username is correctly matching I suppose. But everything else is just using the **$username** variable so happy updating PR if this is preferred.
TehMuffinMoo 5 年之前
父節點
當前提交
5d35c00bf6
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      api/functions/sso-functions.php

+ 2 - 2
api/functions/sso-functions.php

@@ -177,7 +177,7 @@ trait SSOFunctions
 			if ($response->success) {
 				$user = json_decode($response->body, true); // not really needed yet
 				$token = $response->cookies['connect.sid']->value;
-				$this->writeLog('success', 'Overseerr Token Function - Grabbed token', $user['username']);
+				$this->writeLog('success', 'Overseerr Token Function - Grabbed token', $user['plexUsername']);
 			} else {
 				if ($fallback) {
 					$this->writeLog('error', 'Overseerr Token Function - Overseerr did not return Token - Will retry using fallback credentials', $username);
@@ -197,4 +197,4 @@ trait SSOFunctions
 		}
 	}
 	
-}
+}