fix login & vm list + working token

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-25 15:34:10 -07:00
parent 61ccb89925
commit d03ff70b59
3 changed files with 14 additions and 7 deletions

View File

@ -51,6 +51,7 @@ func gorillaSendProtobuf(msg *pb.Event) {
msg := pb.CreateSampleEvent()
msg.Name = "test echo over gorilla websocket"
*/
log.Println("gorillaSendProtobuf() going to Marshal msg =", msg)
data, _ := proto.Marshal(msg)
err2 := gorillaConn.WriteMessage(websocket.BinaryMessage, data)
if err2 != nil {

18
main.go
View File

@ -300,34 +300,40 @@ func watchGUI() {
if (gui.Data.State == "SEND WEBSOCKET") {
event := pb.MakeGetEvent()
if (gui.Data.Current == nil) {
if (gui.Data.Current != nil) {
event.Token = gui.Data.Current.Token
event.Username = gui.Data.Current.Username
}
log.Println("\tTRIGGERING WEBSOCKET pb.MakeGetEvent() event.Token =", event.Token)
log.Println("\tTRIGGERING event.Token =", event.Token)
log.Println("\tTRIGGERING event.Username =", event.Username)
log.Println("\tTRIGGERING event.Email =", event.Email)
gorillaSendProtobuf(event)
gui.Data.State = "READ PROTOBUF"
}
if (gui.Data.State == "SEND LOGIN") {
event := pb.MakeLoginEvent()
if (gui.Data.Current == nil) {
if (gui.Data.Current != nil) {
event.Token = gui.Data.Current.Token
event.Username = gui.Data.Current.Username
event.Password = gui.Data.Current.Password
}
log.Println("\tTRIGGERING LOGIN HERE pb.MakeLoginEvent() event.Token =", event.Token)
log.Println("\tTRIGGERING event.Token =", event.Token)
log.Println("\tTRIGGERING event.Username =", event.Username)
log.Println("\tTRIGGERING event.Email =", event.Email)
gorillaSendProtobuf(event)
gui.Data.State = "READ PROTOBUF"
}
if (gui.Data.State == "CREATE") {
log.Println("\tTRIGGERING CREATE HERE")
event := pb.MakeAddVmEvent()
if (gui.Data.Current == nil) {
if (gui.Data.Current != nil) {
event.Token = gui.Data.Current.Token
event.Username = gui.Data.Current.Username
}
log.Println("\tTRIGGERING CREATE HERE with event.Token =", event.Token)
log.Println("\tTRIGGERING event.Token =", event.Token)
log.Println("\tTRIGGERING event.Username =", event.Username)
log.Println("\tTRIGGERING event.Email =", event.Email)
spew.Dump(event)
gorillaSendProtobuf(event)

View File

@ -19,7 +19,7 @@
{
"nick": "bmath",
"username": "bmath@wit.com",
"token": "eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJ4IjoyLCJyIjoiIiwiY3NyZiI6Ik9rR0JWenphV2cxQjVlN0R5YjRXSzIyWCIsImV4cCI6MTU1OTE4NTc1MiwiaXNzIjoid2l0Iiwic3ViIjoiYm1hdGhAd2l0LmNvbSJ9.vdOAXyt3VIovqEIbivgt6upqR8glZv2UdzFcyudzCmGV-msdZWi_9TZaATyQMxEaVD3K6gRunakyOWK0jw4xxeDUbQym86IKMU2UOjp0tN0z72OmH822NmQ8_AgWiKNI",
"token": "eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJ4IjoyLCJyIjoiIiwiY3NyZiI6IjZMdlRIeVo0N1UzdEU4MTV5UkVmaERWSCIsImV4cCI6MTU1OTQyNjQ1OSwiaXNzIjoid2l0Iiwic3ViIjoiYm1hdGhAd2l0LmNvbSJ9.OUjebDY_e05Q_X7q2dxsjPAof7qhJLAk8WA9eY8IbNg22M3oARikH-IHLACZkQ-yM6-1dmNYRbWaXGZlKd4J7W1uOb2xFRJMMk_LCNZ83cyVI8ddCkPzvOI_IHUJ7Eus",
"hostname": "hosttest.wit.com",
"domainname": "test.wit.com"
}