Stopped #3961 from happening

pull/3970/head
tidusjar 4 years ago
parent bb29b547b3
commit c26f3337ed

@ -88,6 +88,12 @@ namespace Ombi.Schedule.Jobs.Plex
_log.LogInformation("Could not create Plex user since the have no username, PlexUserId: {0}", plexUser.Id); _log.LogInformation("Could not create Plex user since the have no username, PlexUserId: {0}", plexUser.Id);
continue; continue;
} }
if ((plexUser.Email.HasValue()) && await _userManager.FindByEmailAsync(plexUser.Email) != null)
{
_log.LogWarning($"Cannot add user {plexUser.Username} because their email address is already in Ombi, skipping this user");
continue;
}
// Create this users // Create this users
// We do not store a password against the user since they will authenticate via Plex // We do not store a password against the user since they will authenticate via Plex
var newUser = new OmbiUser var newUser = new OmbiUser

@ -457,6 +457,10 @@ namespace Ombi.Controllers.V1
{ {
return Error("You do not have the correct permissions to create this user"); return Error("You do not have the correct permissions to create this user");
} }
if(user.EmailAddress.HasValue() && await UserManager.FindByEmailAsync(user.EmailAddress) != null)
{
return Error("This email has already been taken");
}
var ombiUser = new OmbiUser var ombiUser = new OmbiUser
{ {
Alias = user.Alias, Alias = user.Alias,

Loading…
Cancel
Save