Skip to content

Commit

Permalink
fix: allow hyphen in create token (#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
BradLugo committed Apr 30, 2024
1 parent 84f4e02 commit 57c0603
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/infractl/token/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func validateName(name string) error {
if name == "" {
return errors.New("no name given")
}
match, err := regexp.MatchString(`^[a-zA-Z][a-zA-Z ]*$`, name)
match, err := regexp.MatchString(`^[a-zA-Z][a-zA-Z -]*$`, name)
if err != nil {
return err
}
if !match {
return errors.New("name must be a non-empty alphabetical string")
return errors.New("name must be a non-empty alphabetical string (allowed special chars: space, hyphen)")
}

return nil
Expand Down

0 comments on commit 57c0603

Please sign in to comment.