Commit e28a390a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Move check for incorrect username earlier.

parent 50ad751e
......@@ -211,6 +211,11 @@ func startClient(conn *websocket.Conn) (err error) {
return
}
if strings.ContainsRune(m.Username, ' ') {
err = userError("don't put spaces in your username")
return
}
c := &webClient{
id: m.Id,
username: m.Username,
......@@ -244,11 +249,6 @@ func startClient(conn *websocket.Conn) (err error) {
c.writerDone = make(chan struct{})
go clientWriter(conn, c.writeCh, c.writerDone)
if strings.ContainsRune(m.Username, ' ') {
err = userError("don't put spaces in your username")
return
}
g, users, err := addClient(m.Group, c, m.Username, m.Password)
if err != nil {
return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment