Allow email on auth queries

This commit is contained in:
Benedikt Kulmann
2020-10-19 12:29:10 +02:00
parent d902f50b42
commit cb5a78f0dd

View File

@@ -122,9 +122,15 @@ func (s Service) ListAccounts(ctx context.Context, in *proto.ListAccountsRequest
}
ids, err := s.index.FindBy(&proto.Account{}, "OnPremisesSamAccountName", match[1])
if err != nil || len(ids) != 1 {
if err != nil || len(ids) > 1 {
return merrors.Unauthorized(s.id, "account not found or invalid credentials")
}
if len(ids) == 0 {
ids, err = s.index.FindBy(&proto.Account{}, "Mail", match[1])
if err != nil || len(ids) != 1 {
return merrors.Unauthorized(s.id, "account not found or invalid credentials")
}
}
a := &proto.Account{}
err = s.repo.LoadAccount(ctx, ids[0], a)