fix: filter name
This commit is contained in:
parent
3aacf82c57
commit
553682d74f
7
main.go
7
main.go
|
@ -11,6 +11,7 @@ import (
|
|||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -30,6 +31,8 @@ const (
|
|||
bindHost = "[::1]"
|
||||
)
|
||||
|
||||
var filterName = regexp.MustCompile("[^a-z0-9-]+")
|
||||
|
||||
func main() {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
|
||||
defer stop()
|
||||
|
@ -153,7 +156,9 @@ func (srv *server) AddUser(pubkey ssh.PublicKey) *user {
|
|||
u.pubkey = pubkey
|
||||
|
||||
babbler := babble.NewBabbler()
|
||||
u.name = strings.ToLower(babbler.Babble())
|
||||
u.name = babbler.Babble()
|
||||
u.name = strings.ToLower(u.name)
|
||||
u.name = filterName.ReplaceAllString(u.name, "")
|
||||
|
||||
u.bindPort = srv.nextPort()
|
||||
u.bindHost = srv.bindHost
|
||||
|
|
Loading…
Reference in New Issue
Block a user