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
This commit is contained in:
tidusjar 2017-03-29 21:10:06 +01:00
commit 41021240c9
4 changed files with 27 additions and 21 deletions

View file

@ -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

View file

@ -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!
{