Răsfoiți Sursa

adding network check to SSO login

afeiszli 3 ani în urmă
părinte
comite
8f9dd330b1
1 a modificat fișierele cu 4 adăugiri și 1 ștergeri
  1. 4 1
      netclient/command/commands.go

+ 4 - 1
netclient/command/commands.go

@@ -24,7 +24,10 @@ func Join(cfg *config.ClientConfig, privateKey string) error {
 		// Do that before the Joining Network flow by performing the end point auth flow
 		// if performed successfully an access key is obtained from the server and then we
 		// proceed with the usual flow 'pretending' that user is feeded us with an access token
-		logger.Log(1, "Logging into %s via:", cfg.Network, cfg.SsoServer)
+		if len(cfg.Network) == 0 || cfg.Network == "all" {
+			return fmt.Errorf("no network provided. Specify network with \"-n <net name>\"")
+		}
+		logger.Log(1, fmt.Sprintf("Logging into %s via:", cfg.Network), cfg.SsoServer)
 		err = functions.JoinViaSSo(cfg, privateKey)
 		if err != nil {
 			logger.Log(0, "Join via OIDC failed: ", err.Error())