From 8de737f0b332345b1ad6ef6f3ffbed6810026870 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Wed, 15 Jun 2022 17:33:48 +0800 Subject: [PATCH] hash userID --- internal/demo/register/set_password.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/demo/register/set_password.go b/internal/demo/register/set_password.go index 8a360b2d9..8d362ce37 100644 --- a/internal/demo/register/set_password.go +++ b/internal/demo/register/set_password.go @@ -11,7 +11,10 @@ import ( "Open_IM/pkg/utils" "encoding/json" "github.com/gin-gonic/gin" + "math/big" "net/http" + "strconv" + "time" ) type ParamsSetPassword struct { @@ -52,7 +55,13 @@ func SetPassword(c *gin.Context) { return } } - userID := utils.Base64Encode(account) + //userID := utils.Base64Encode(account) + + userID := utils.Md5(params.OperationID + strconv.FormatInt(time.Now().UnixNano(), 10)) + bi := big.NewInt(0) + bi.SetString(userID[0:8], 16) + userID = bi.String() + url := config.Config.Demo.ImAPIURL + "/auth/user_register" openIMRegisterReq := api.UserRegisterReq{} openIMRegisterReq.OperationID = params.OperationID