diff --git a/client/cmd/main.go b/client/cmd/main.go index fe60dae..9194af9 100644 --- a/client/cmd/main.go +++ b/client/cmd/main.go @@ -133,7 +133,9 @@ func _main() error { AddItem("jack in", "connect using an existing account", '1', func() { pages.SwitchToPage("game") }). - AddItem("rez a toon", "create a new account", '2', nil). + AddItem("rez a toon", "create a new account", '2', func() { + pages.SwitchToPage("register") + }). AddItem("open the hood", "client configuration", '3', nil). AddItem("get outta here", "quit the client", '4', func() { app.Stop() @@ -141,6 +143,29 @@ func _main() error { pages.AddPage("main", mainPage, true, false) + unfi := tview.NewInputField().SetLabel("account name") + pwfi := tview.NewInputField().SetLabel("password").SetMaskCharacter('~') + + registerPage := tview.NewForm().AddFormItem(unfi).AddFormItem(pwfi). + SetCancelFunc(func() { + pages.SwitchToPage("main") + }) + + submitFunc := func() { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + cs.Client.Register(ctx, &proto.AuthInfo{ + Username: unfi.GetText(), + Password: pwfi.GetText(), + }) + } + + registerPage.AddButton("gimme that shit", submitFunc) + registerPage.AddButton("nah get outta here", func() { + pages.SwitchToPage("main") + }) + pages.AddPage("register", registerPage, true, false) + msgView := tview.NewTextView().SetScrollable(true).SetWrap(true).SetWordWrap(true) cs.messagesView = msgView diff --git a/server/cmd/main.go b/server/cmd/main.go index d03970c..37bdc02 100644 --- a/server/cmd/main.go +++ b/server/cmd/main.go @@ -83,6 +83,7 @@ func (s *gameWorldServer) Messages(si *proto.SessionInfo, stream proto.GameWorld } func (s *gameWorldServer) Register(ctx context.Context, auth *proto.AuthInfo) (*proto.SessionInfo, error) { + log.Printf("COOL HI HELLO %s %s", auth.Username, auth.Password) // TODO return nil, nil }