diff --git a/pkg/controller/api/username_check.go b/pkg/controller/api/username_check.go index 66886d4..410f3ca 100644 --- a/pkg/controller/api/username_check.go +++ b/pkg/controller/api/username_check.go @@ -5,6 +5,7 @@ import ( "net/http" "strings" + "code.nonshy.com/nonshy/website/pkg/config" "code.nonshy.com/nonshy/website/pkg/models" ) @@ -49,6 +50,16 @@ func UsernameCheck() http.HandlerFunc { return } + // Is it reserved? + for _, cmp := range config.ReservedUsernames { + if username == cmp { + SendJSON(w, http.StatusOK, Response{ + Error: "That username is reserved, please choose a different username.", + }) + return + } + } + // Send success response. SendJSON(w, http.StatusOK, Response{ OK: true,