Sanitize+truncate display names on registration+change. For #2527
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/core/user"
|
||||
"github.com/owncast/owncast/core/webhooks"
|
||||
"github.com/owncast/owncast/utils"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -27,9 +28,7 @@ func (s *Server) userNameChanged(eventData chatClientEvent) {
|
||||
blocklist := data.GetForbiddenUsernameList()
|
||||
|
||||
// Names have a max length
|
||||
if len(proposedUsername) > config.MaxChatDisplayNameLength {
|
||||
proposedUsername = proposedUsername[:config.MaxChatDisplayNameLength]
|
||||
}
|
||||
proposedUsername = utils.MakeSafeStringOfLength(proposedUsername, config.MaxChatDisplayNameLength)
|
||||
|
||||
for _, blockedName := range blocklist {
|
||||
normalizedName := strings.TrimSpace(blockedName)
|
||||
|
||||
Reference in New Issue
Block a user