diff options
author | Sandro Santilli <strk@kbt.io> | 2019-09-24 19:12:56 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-09-24 13:12:56 -0400 |
commit | 3dd1cee331b8d0beb84e2f92481183520939213a (patch) | |
tree | b190cc87e251acc4e2a1a8f6c4d8070c3d967b63 | |
parent | 43c0249583e3337f9b2e87f4797eb16f1678c862 (diff) | |
download | gitea-3dd1cee331b8d0beb84e2f92481183520939213a.tar.gz gitea-3dd1cee331b8d0beb84e2f92481183520939213a.zip |
Test more reserved usernames (#8263)
* Test more reserved usernames
* Add more reserved usernames, sort them
* Reserve "attachments" username (is a used route)
* It's "avatars" being reserved, not "avatar"
-rw-r--r-- | integrations/user_test.go | 15 | ||||
-rw-r--r-- | models/user.go | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/integrations/user_test.go b/integrations/user_test.go index 6d67927d16..0a6fdd19d5 100644 --- a/integrations/user_test.go +++ b/integrations/user_test.go @@ -74,9 +74,22 @@ func TestRenameReservedUsername(t *testing.T) { prepareTestEnv(t) reservedUsernames := []string{ + "admin", + "api", + "attachments", + "avatars", + "explore", "help", - "user", + "install", + "issues", + "login", + "metrics", + "notifications", + "org", + "pulls", + "repo", "template", + "user", } session := loginUser(t, "user2") diff --git a/models/user.go b/models/user.go index 5e87473e86..e31f8b8534 100644 --- a/models/user.go +++ b/models/user.go @@ -776,6 +776,7 @@ func NewGhostUser() *User { var ( reservedUsernames = []string{ + "attachments", "admin", "api", "assets", |