Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/cli/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ func validateOrgName(org string) error {
if org == "" {
return fmt.Errorf("organization name cannot be empty")
}
if len(org) > 39 {
return fmt.Errorf("organization name too long (max 39 characters)")
}
if strings.HasPrefix(org, "-") || strings.HasSuffix(org, "-") {
return fmt.Errorf("organization name cannot start or end with a hyphen")
}
if strings.Contains(org, "--") {
return fmt.Errorf("organization name cannot contain consecutive hyphens")
}
for _, c := range org {
if !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-') {
return fmt.Errorf("organization name contains invalid character: %c", c)
Expand Down
Loading
Loading