diff --git a/src/Ombi.Core/Authentication/OmbiUserManager.cs b/src/Ombi.Core/Authentication/OmbiUserManager.cs index b9453749d..185677215 100644 --- a/src/Ombi.Core/Authentication/OmbiUserManager.cs +++ b/src/Ombi.Core/Authentication/OmbiUserManager.cs @@ -110,7 +110,8 @@ public async Task RequiresPassword(OmbiUser user) /// private async Task CheckPlexPasswordAsync(OmbiUser user, string password) { - var result = await _plexApi.SignIn(new UserRequest { password = password, login = user.UserName }); + var login = user.EmailLogin ? user.Email : user.UserName; + var result = await _plexApi.SignIn(new UserRequest { password = password, login = login }); if (result.user?.authentication_token != null) { return true; diff --git a/src/Ombi.Store/Entities/OmbiUser.cs b/src/Ombi.Store/Entities/OmbiUser.cs index 545d8dd17..28df10ac6 100644 --- a/src/Ombi.Store/Entities/OmbiUser.cs +++ b/src/Ombi.Store/Entities/OmbiUser.cs @@ -32,5 +32,8 @@ public class OmbiUser : IdentityUser [NotMapped] public string UserAlias => string.IsNullOrEmpty(Alias) ? UserName : Alias; + + [NotMapped] + public bool EmailLogin { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/Controllers/TokenController.cs b/src/Ombi/Controllers/TokenController.cs index 93e8a025e..18da61e3a 100644 --- a/src/Ombi/Controllers/TokenController.cs +++ b/src/Ombi/Controllers/TokenController.cs @@ -58,6 +58,8 @@ await _audit.Record(AuditType.None, AuditArea.Authentication, { return new UnauthorizedResult(); } + + user.EmailLogin = true; } // Verify Password