mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 18:16:55 -07:00
Update the Emby Connect Username in the user importer. To update the emby connect email address we do it when the user logs in, since the only way to get that information is to use the users Username and Password, since we do not keep this information we cannot do it in the User Importer, but if they have successfully logged in via Emby Connect then we check if we need to update the email address on login
This commit is contained in:
parent
a06496bb03
commit
6e04e2effe
2 changed files with 16 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue