diff options
Diffstat (limited to 'model/user.go')
-rw-r--r-- | model/user.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/model/user.go b/model/user.go index 2412c2ec7..f380a7550 100644 --- a/model/user.go +++ b/model/user.go @@ -10,6 +10,7 @@ import ( "net/http" "regexp" "strings" + "unicode" "unicode/utf8" "golang.org/x/crypto/bcrypt" @@ -142,7 +143,7 @@ func (u *User) PreSave() { } if u.Username == "" { - u.Username = NewId() + u.Username = "n" + NewId() } if u.AuthData != nil && *u.AuthData == "" { @@ -572,6 +573,10 @@ func IsValidUsername(s string) bool { return false } + if !unicode.IsLetter(rune(s[0])) { + return false + } + for _, restrictedUsername := range restrictedUsernames { if s == restrictedUsername { return false |