|
|
package user
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
|
|
|
"net/http"
|
|
|
"opp/internal/repository"
|
...
|
...
|
@@ -106,10 +107,10 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if !strings.EqualFold(request.OldPwd, user.Passwd) {
|
|
|
err = protocol.NewErrWithMessage(2028)
|
|
|
return
|
|
|
}
|
|
|
//if !strings.EqualFold(request.OldPwd, user.Passwd) {
|
|
|
// err = protocol.NewErrWithMessage(2028)
|
|
|
// return
|
|
|
//}
|
|
|
|
|
|
//new
|
|
|
var message protocol.Message
|
...
|
...
|
@@ -126,17 +127,20 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
|
return
|
|
|
}
|
|
|
if loginResponse.Id != user.UserCenterId {
|
|
|
log.Error(fmt.Sprintf("用户中心uid不一致 input:%v want:%v", loginResponse.Id, user.UserCenterId))
|
|
|
err = protocol.NewErrWithMessage(1)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
log.Debug(fmt.Sprintf("修改密码 simnum:%v ucenter_id:%v pwd:%v", user.Phone, user.UserCenterId, request.NewPwd))
|
|
|
//修改密码
|
|
|
if _, err = agg.RequestUserCenter(protocol.MethodGetUser, http.MethodPut, nil, &message); err != nil {
|
|
|
|
|
|
if _, err = agg.RequestUserCenter(fmt.Sprintf("%v%v", protocol.MethodGetUser, loginResponse.Id), http.MethodPut, &protocol.UCenterPutUserRequest{
|
|
|
PassWord: request.NewPwd,
|
|
|
}, &message); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
|
|
//err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
|