bom/server/login.go

22 lines
451 B
Go

package main
import (
"bytes"
"fmt"
"server/core"
"server/packet"
)
// login checks the account credentials and gives a network peer access to an account.
func login(data []byte, client *core.Client) {
fmt.Println("2 - login!")
if bytes.Equal(data, []byte("password")) {
fmt.Println("login success")
server.Send(packet.LOGIN, []byte{0}, client)
} else {
fmt.Println("login failure")
server.Send(packet.LOGIN, []byte{1}, client)
}
}