2
0
Эх сурвалжийг харах

Merge pull request #270 from porter-dev/beta.3.github-actions-ci

update token login w/ better error msg
abelanger5 5 жил өмнө
parent
commit
5cda0c8181
1 өөрчлөгдсөн 7 нэмэгдсэн , 0 устгасан
  1. 7 0
      cli/cmd/auth.go

+ 7 - 0
cli/cmd/auth.go

@@ -91,6 +91,13 @@ func login() error {
 		}
 		}
 
 
 		client = api.NewClientWithToken(getHost()+"/api", token)
 		client = api.NewClientWithToken(getHost()+"/api", token)
+
+		user, _ := client.AuthCheck(context.Background())
+
+		if user == nil {
+			color.Red("Invalid token.")
+			return nil
+		}
 	} else {
 	} else {
 		client = api.NewClient(getHost()+"/api", "cookie.json")
 		client = api.NewClient(getHost()+"/api", "cookie.json")
 	}
 	}