Browse Source

Added public entries to reserved keywords list

Closes #3728
pull/3755/merge
Flare 8 years ago committed by Unknwon
parent
commit
952e510dfa
No known key found for this signature in database
GPG Key ID: FB9F411CDD69BEC1
  1. 8
      models/user.go

8
models/user.go

@ -489,12 +489,12 @@ func NewGhostUser() *User {
} }
var ( var (
reversedUsernames = []string{"debug", "raw", "install", "api", "avatar", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin", "new", ".", ".."} reservedUsernames = []string{"assets", "css", "img", "js", "less", "plugins", "debug", "raw", "install", "api", "avatar", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin", "new", ".", ".."}
reversedUserPatterns = []string{"*.keys"} reservedUserPatterns = []string{"*.keys"}
) )
// isUsableName checks if name is reserved or pattern of name is not allowed // isUsableName checks if name is reserved or pattern of name is not allowed
// based on given reversed names and patterns. // based on given reserved names and patterns.
// Names are exact match, patterns can be prefix or suffix match with placeholder '*'. // Names are exact match, patterns can be prefix or suffix match with placeholder '*'.
func isUsableName(names, patterns []string, name string) error { func isUsableName(names, patterns []string, name string) error {
name = strings.TrimSpace(strings.ToLower(name)) name = strings.TrimSpace(strings.ToLower(name))
@ -519,7 +519,7 @@ func isUsableName(names, patterns []string, name string) error {
} }
func IsUsableUsername(name string) error { func IsUsableUsername(name string) error {
return isUsableName(reversedUsernames, reversedUserPatterns, name) return isUsableName(reservedUsernames, reservedUserPatterns, name)
} }
// CreateUser creates record of a new user. // CreateUser creates record of a new user.

Loading…
Cancel
Save