mirror of
https://github.com/h44z/wg-portal.git
synced 2026-02-22 18:36:21 +00:00
fix: improve peer email handling logic (#620)
This commit is contained in:
@@ -190,20 +190,22 @@ func (m Manager) resolveEmail(ctx context.Context, peer *domain.Peer) (string, d
|
||||
if err == nil {
|
||||
slog.Debug("peer email: using user-identifier as email",
|
||||
"peer", peer.Identifier, "email", peer.UserIdentifier)
|
||||
return string(peer.UserIdentifier), domain.User{}
|
||||
} else {
|
||||
return string(peer.UserIdentifier), domain.User{
|
||||
Email: string(peer.UserIdentifier),
|
||||
}
|
||||
}
|
||||
|
||||
slog.Debug("peer email: skipping peer email",
|
||||
"peer", peer.Identifier,
|
||||
"reason", "peer has no user linked and user-identifier is not a valid email address")
|
||||
return "", domain.User{}
|
||||
}
|
||||
} else {
|
||||
|
||||
slog.Debug("peer email: skipping peer email",
|
||||
"peer", peer.Identifier,
|
||||
"reason", "user has no user linked")
|
||||
return "", domain.User{}
|
||||
}
|
||||
}
|
||||
|
||||
if user.Email == "" {
|
||||
slog.Debug("peer email: skipping peer email",
|
||||
|
||||
Reference in New Issue
Block a user