diff --git a/src/Ombi.Core/Authentication/OmbiUserManager.cs b/src/Ombi.Core/Authentication/OmbiUserManager.cs index b939042b4..49a4329d4 100644 --- a/src/Ombi.Core/Authentication/OmbiUserManager.cs +++ b/src/Ombi.Core/Authentication/OmbiUserManager.cs @@ -108,6 +108,14 @@ namespace Ombi.Core.Authentication var result = await _embyApi.LoginConnectUser(user.UserName, password); if (result.AccessToken.HasValue()) { + // We cannot update the email address in the user importer due to there is no way + // To get this info from Emby Connect without the username and password. + // So we do it here! + if (!user.Email.Equals(result.User?.Email)) + { + user.Email = result.User?.Email; + await UpdateAsync(user); + } return true; } } diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs index cbaeb920d..8cf1a4b52 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs @@ -126,6 +126,14 @@ namespace Ombi.Schedule.Jobs.Emby existingEmbyUser.EmbyConnectUserId = embyUser.ConnectUserId.HasValue() ? embyUser.ConnectUserId : string.Empty; + if (existingEmbyUser.IsEmbyConnect) + { + // Note: We do not have access to any of the emby connect details e.g. email + // Since we need the username and password to connect to emby connect, + // We update the email address in the OmbiUserManager when the emby connect user logs in + existingEmbyUser.UserName = embyUser.ConnectUserName; + } + await _userManager.UpdateAsync(existingEmbyUser); } }