From 41021240c9855919f8847a2cc3cb762e488be8ea Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 29 Mar 2017 21:10:06 +0100 Subject: [PATCH 1/2] Fixed an issue where we were retrying the API call when the Plex users login creds were invalid. #1217 Also removed the Auto update button from the Update page --- Ombi.Api/PlexApi.cs | 3 +-- Ombi.UI/Modules/Admin/AdminModule.cs | 12 +++++------ Ombi.UI/Modules/UserLoginModule.cs | 27 +++++++++++++++--------- Ombi.UI/Views/SystemStatus/Status.cshtml | 4 ++-- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Ombi.Api/PlexApi.cs b/Ombi.Api/PlexApi.cs index 85e96ea68..8e598d965 100644 --- a/Ombi.Api/PlexApi.cs +++ b/Ombi.Api/PlexApi.cs @@ -77,8 +77,7 @@ namespace Ombi.Api request.AddJsonBody(userModel); - var obj = RetryHandler.Execute(() => Api.Execute (request, new Uri(SignInUri)), - (exception, timespan) => Log.Error (exception, "Exception when calling SignIn for Plex, Retrying {0}", timespan)); + var obj = Api.Execute (request, new Uri(SignInUri)); return obj; } diff --git a/Ombi.UI/Modules/Admin/AdminModule.cs b/Ombi.UI/Modules/Admin/AdminModule.cs index 72f60612e..f3c8acb8a 100644 --- a/Ombi.UI/Modules/Admin/AdminModule.cs +++ b/Ombi.UI/Modules/Admin/AdminModule.cs @@ -520,14 +520,14 @@ namespace Ombi.UI.Modules.Admin Message = "Plex is enabled, we cannot enable Plex and Emby" }); } - } - // Get the users - var users = EmbyApi.GetUsers(emby.FullUri, emby.ApiKey); - // Find admin - var admin = users.FirstOrDefault(x => x.Policy.IsAdministrator); - emby.AdministratorId = admin?.Id; + // Get the users + var users = EmbyApi.GetUsers(emby.FullUri, emby.ApiKey); + // Find admin + var admin = users.FirstOrDefault(x => x.Policy.IsAdministrator); + emby.AdministratorId = admin?.Id; + } var result = await EmbySettings.SaveSettingsAsync(emby); return Response.AsJson(result diff --git a/Ombi.UI/Modules/UserLoginModule.cs b/Ombi.UI/Modules/UserLoginModule.cs index a8df7b990..6330625ac 100644 --- a/Ombi.UI/Modules/UserLoginModule.cs +++ b/Ombi.UI/Modules/UserLoginModule.cs @@ -165,20 +165,27 @@ namespace Ombi.UI.Modules { if (settings.UserAuthentication) // Check against the users in Plex { - Log.Debug("Need to auth"); - authenticated = CheckIfUserIsInPlexFriends(username, plexSettings.PlexAuthToken); - if (authenticated) + try { - userId = GetUserIdIsInPlexFriends(username, plexSettings.PlexAuthToken); + Log.Debug("Need to auth"); + authenticated = CheckIfUserIsInPlexFriends(username, plexSettings.PlexAuthToken); + if (authenticated) + { + userId = GetUserIdIsInPlexFriends(username, plexSettings.PlexAuthToken); + } + if (CheckIfUserIsOwner(plexSettings.PlexAuthToken, username)) + { + Log.Debug("User is the account owner"); + authenticated = true; + isOwner = true; + userId = GetOwnerId(plexSettings.PlexAuthToken, username); + } + Log.Debug("Friends list result = {0}", authenticated); } - if (CheckIfUserIsOwner(plexSettings.PlexAuthToken, username)) + catch (Exception) { - Log.Debug("User is the account owner"); - authenticated = true; - isOwner = true; - userId = GetOwnerId(plexSettings.PlexAuthToken, username); + return Response.AsJson(new { result = false, message = Resources.UI.UserLogin_IncorrectUserPass }) } - Log.Debug("Friends list result = {0}", authenticated); } else if (!settings.UserAuthentication) // No auth, let them pass! { diff --git a/Ombi.UI/Views/SystemStatus/Status.cshtml b/Ombi.UI/Views/SystemStatus/Status.cshtml index c7955e00c..00c625b86 100644 --- a/Ombi.UI/Views/SystemStatus/Status.cshtml +++ b/Ombi.UI/Views/SystemStatus/Status.cshtml @@ -57,11 +57,11 @@

- + @* @Html.ToolTip("This is if you run Ombi outside of a regular install e.g. you are launching with a custom port. This field will be used after we have updated to launch the application.")
- + *@ } else { From ff7b48c399fe699a352b3f26a8bc13c785599165 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 29 Mar 2017 21:17:38 +0100 Subject: [PATCH 2/2] Syntax error --- Ombi.UI/Modules/UserLoginModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ombi.UI/Modules/UserLoginModule.cs b/Ombi.UI/Modules/UserLoginModule.cs index 6330625ac..0e0bdef12 100644 --- a/Ombi.UI/Modules/UserLoginModule.cs +++ b/Ombi.UI/Modules/UserLoginModule.cs @@ -184,7 +184,7 @@ namespace Ombi.UI.Modules } catch (Exception) { - return Response.AsJson(new { result = false, message = Resources.UI.UserLogin_IncorrectUserPass }) + return Response.AsJson(new {result = false, message = Resources.UI.UserLogin_IncorrectUserPass}); } } else if (!settings.UserAuthentication) // No auth, let them pass!