|
|
|
@ -17,6 +17,7 @@ import (
|
|
|
|
|
|
|
|
|
|
type ParamsSetPassword struct {
|
|
|
|
|
Email string `json:"email"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
PhoneNumber string `json:"phoneNumber"`
|
|
|
|
|
Password string `json:"password"`
|
|
|
|
|
VerificationCode string `json:"verificationCode"`
|
|
|
|
@ -38,6 +39,9 @@ func SetPassword(c *gin.Context) {
|
|
|
|
|
} else {
|
|
|
|
|
account = params.PhoneNumber
|
|
|
|
|
}
|
|
|
|
|
if params.Name == "" {
|
|
|
|
|
params.Name = account
|
|
|
|
|
}
|
|
|
|
|
if params.VerificationCode != config.Config.Demo.SuperCode {
|
|
|
|
|
accountKey := account + "_" + constant.VerificationCodeForRegisterSuffix
|
|
|
|
|
v, err := db.DB.GetAccountCode(accountKey)
|
|
|
|
@ -54,7 +58,7 @@ func SetPassword(c *gin.Context) {
|
|
|
|
|
openIMRegisterReq.OperationID = params.OperationID
|
|
|
|
|
openIMRegisterReq.Platform = params.Platform
|
|
|
|
|
openIMRegisterReq.UserID = account
|
|
|
|
|
openIMRegisterReq.Nickname = account
|
|
|
|
|
openIMRegisterReq.Nickname = params.Name
|
|
|
|
|
openIMRegisterReq.Secret = config.Config.Secret
|
|
|
|
|
openIMRegisterResp := api.UserRegisterResp{}
|
|
|
|
|
bMsg, err := http2.Post(url, openIMRegisterReq, 2)
|
|
|
|
@ -69,7 +73,7 @@ func SetPassword(c *gin.Context) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.NewError(params.OperationID, utils.GetSelfFuncName(), err.Error())
|
|
|
|
|
}
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": "register failed: "+openIMRegisterResp.ErrMsg})
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": "register failed: " + openIMRegisterResp.ErrMsg})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
log.Info(params.OperationID, "begin store mysql", account, params.Password)
|
|
|
|
|