From ae24b131f7760964aee7f700f2a7bfa07cfaa6fd Mon Sep 17 00:00:00 2001 From: idanasulinStrech Date: Thu, 2 Nov 2023 14:42:12 +0200 Subject: [PATCH] fix response of OSS signup --- server/memphis_handlers_user_mgmt.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/server/memphis_handlers_user_mgmt.go b/server/memphis_handlers_user_mgmt.go index 58be5f0a3..ba3755575 100644 --- a/server/memphis_handlers_user_mgmt.go +++ b/server/memphis_handlers_user_mgmt.go @@ -390,6 +390,26 @@ func (umh UserMgmtHandler) AddUserSignUp(c *gin.Context) { env = "docker" } + exist, tenant, err := db.GetTenantByName(newUser.TenantName) + if err != nil { + serv.Errorf("[tenant: %v][user: %v]CreateUserSignUp at GetTenantByName: User %v: %v", newUser.TenantName, newUser.Username, body.Username, err.Error()) + c.AbortWithStatusJSON(500, gin.H{"message": "Server error"}) + return + } + if !exist { + serv.Warnf("[tenant: %v][user: %v]CreateUserSignUp: User %v: tenant %v does not exist", newUser.TenantName, newUser.Username, body.Username, newUser.TenantName) + c.AbortWithStatusJSON(500, gin.H{"message": "Server error"}) + return + } + + decriptionKey := getAESKey() + decryptedUserPassword, err := DecryptAES(decriptionKey, tenant.InternalWSPass) + if err != nil { + serv.Errorf("CreateUserSignUp: User " + body.Username + ": " + err.Error()) + c.AbortWithStatusJSON(500, gin.H{"message": "Server error"}) + return + } + shouldSendAnalytics, _ := shouldSendAnalytics() if shouldSendAnalytics { analyticsParams := map[string]interface{}{ @@ -428,6 +448,8 @@ func (umh UserMgmtHandler) AddUserSignUp(c *gin.Context) { "rest_gw_port": serv.opts.RestGwPort, "user_pass_based_auth": configuration.USER_PASS_BASED_AUTH, "connection_token": configuration.CONNECTION_TOKEN, + "account_id": tenant.ID, + "internal_ws_pass": decryptedUserPassword, "dls_retention": serv.opts.DlsRetentionHours[newUser.TenantName], "logs_retention": serv.opts.LogsRetentionDays, "max_msg_size_mb": serv.opts.MaxPayload / 1024 / 1024,