Skip to content

Commit

Permalink
Fix the issue where the user could not login if the plex account only…
Browse files Browse the repository at this point in the history
… allows email logins
  • Loading branch information
tidusjar committed Mar 2, 2018
1 parent 00d368b commit 98b4036
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Ombi.Core/Authentication/OmbiUserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public async Task<bool> RequiresPassword(OmbiUser user)
/// <returns></returns>
private async Task<bool> 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;
Expand Down
3 changes: 3 additions & 0 deletions src/Ombi.Store/Entities/OmbiUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ public class OmbiUser : IdentityUser

[NotMapped]
public string UserAlias => string.IsNullOrEmpty(Alias) ? UserName : Alias;

[NotMapped]
public bool EmailLogin { get; set; }
}
}
2 changes: 2 additions & 0 deletions src/Ombi/Controllers/TokenController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ await _audit.Record(AuditType.None, AuditArea.Authentication,
{
return new UnauthorizedResult();
}

user.EmailLogin = true;
}

// Verify Password
Expand Down

0 comments on commit 98b4036

Please sign in to comment.