Skip to content

Commit

Permalink
[gitea] Drop "@" from email sender to avoid spam filters (go-gitea#29109
Browse files Browse the repository at this point in the history
)

Commit 360b3fd (Include username in email headers (go-gitea#28981),
2024-02-03) adds usernames to the From field of notification emails in
the form of `Display Name (@username)`, to prevent spoofing. However,
some email filtering software flags "@" in the display name part of the
From field as potential spoofing, as you could set the display name part
to another email address than the one you are sending from (e.g.
`From: "apparent@email-address" <actual@email-address>`). To avoid
being flagged, instead send emails from `Display Name (username)`.

Closes: go-gitea#29107

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 5b2fd0f)
  • Loading branch information
gwymor authored and earl-warren committed Feb 11, 2024
1 parent 22fd29d commit 9a1d5c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,14 @@ func (u *User) GetDisplayName() string {
}

// GetCompleteName returns the the full name and username in the form of
// "Full Name (@username)" if full name is not empty, otherwise it returns
// "@username".
// "Full Name (username)" if full name is not empty, otherwise it returns
// "username".
func (u *User) GetCompleteName() string {
trimmedFullName := strings.TrimSpace(u.FullName)
if len(trimmedFullName) > 0 {
return fmt.Sprintf("%s (@%s)", trimmedFullName, u.Name)
return fmt.Sprintf("%s (%s)", trimmedFullName, u.Name)
}
return fmt.Sprintf("@%s", u.Name)
return u.Name
}

func gitSafeName(name string) string {
Expand Down

0 comments on commit 9a1d5c5

Please sign in to comment.