коммит произвёл
GitHub
родитель
5ff151c327
Коммит
3ad80a2d0f
@@ -19,6 +19,7 @@ import (
|
|||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v5/services/timezones"
|
"github.com/mattermost/mattermost-server/v5/services/timezones"
|
||||||
|
"github.com/mattermost/mattermost-server/v5/shared/mlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -861,8 +862,8 @@ func IsValidUsername(s string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func CleanUsername(s string) string {
|
func CleanUsername(username string) string {
|
||||||
s = NormalizeUsername(strings.Replace(s, " ", "-", -1))
|
s := NormalizeUsername(strings.Replace(username, " ", "-", -1))
|
||||||
|
|
||||||
for _, value := range reservedName {
|
for _, value := range reservedName {
|
||||||
if s == value {
|
if s == value {
|
||||||
@@ -883,6 +884,8 @@ func CleanUsername(s string) string {
|
|||||||
|
|
||||||
if !IsValidUsername(s) {
|
if !IsValidUsername(s) {
|
||||||
s = "a" + NewId()
|
s = "a" + NewId()
|
||||||
|
mlog.Warn("Generating new username since provided username was invalid",
|
||||||
|
mlog.String("provided_username", username), mlog.String("new_username", s))
|
||||||
}
|
}
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user