mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-07-06 08:37:30 +02:00
[gitea] Drop "@" from email sender to avoid spam filters (#29109)
Commit360b3fd17c
(Include username in email headers (#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: #29107 --------- Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit5b2fd0fc19
)
This commit is contained in:
parent
22fd29d3b7
commit
9a1d5c549c
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue