abhishek9686 пре 1 година
родитељ
комит
bc42f1ebf0
2 измењених фајлова са 22 додато и 1 уклоњено
  1. 1 1
      pro/controllers/users.go
  2. 21 0
      pro/logic/security.go

+ 1 - 1
pro/controllers/users.go

@@ -219,7 +219,7 @@ func inviteUsers(w http.ResponseWriter, r *http.Request) {
 		}
 		if servercfg.DeployedByOperator() {
 			u, err = url.Parse(fmt.Sprintf("%s/invite?tenant_id=%s&email=%s&invite_code=%s",
-				proLogic.GetAccountsHost(), url.QueryEscape(servercfg.GetNetmakerTenantID()), url.QueryEscape(invite.Email), url.QueryEscape(invite.InviteCode)))
+				proLogic.GetAccountsUIHost(), url.QueryEscape(servercfg.GetNetmakerTenantID()), url.QueryEscape(invite.Email), url.QueryEscape(invite.InviteCode)))
 			if err != nil {
 				slog.Error("failed to parse to invite url", "error", err)
 				return

+ 21 - 0
pro/logic/security.go

@@ -21,6 +21,16 @@ const (
 	accountsHostProduction = "https://api.accounts.netmaker.io"
 )
 
+// constants for accounts UI hosts
+const (
+	// accountsUIHostDevelopment is the accounts UI host for development environment
+	accountsUIHostDevelopment = "https://account.dev.netmaker.io"
+	// accountsUIHostStaging is the accounts UI host for staging environment
+	accountsUIHostStaging = "https://account.staging.netmaker.io"
+	// accountsUIHostProduction is the accounts UI host for production environment
+	accountsUIHostProduction = "https://account.netmaker.io"
+)
+
 func NetworkPermissionsCheck(username string, r *http.Request) error {
 	// at this point global checks should be completed
 	user, err := logic.GetUser(username)
@@ -215,3 +225,14 @@ func GetAccountsHost() string {
 		return accountsHostProduction
 	}
 }
+
+func GetAccountsUIHost() string {
+	switch servercfg.GetEnvironment() {
+	case "dev":
+		return accountsUIHostDevelopment
+	case "staging":
+		return accountsUIHostStaging
+	default:
+		return accountsUIHostProduction
+	}
+}