- RegisterUser修改操作人员为IP加认证ID

This commit is contained in:
gazebo
2019-09-04 16:47:20 +08:00
parent 8067c8f3de
commit c2f76e38b6
2 changed files with 3 additions and 3 deletions

View File

@@ -101,7 +101,7 @@ func init() {
auth2.Init(userProvider)
}
func RegisterUser(user *model.User, mobileVerifyCode string, inAuthInfo *auth2.AuthInfo) (outAuthInfo *auth2.AuthInfo, err error) {
func RegisterUser(ctx *jxcontext.Context, user *model.User, mobileVerifyCode string, inAuthInfo *auth2.AuthInfo) (outAuthInfo *auth2.AuthInfo, err error) {
mobileAuth, err2 := auth2.Login(auth2.AuthTypeMobile, utils.Pointer2String(user.Mobile), auth2.UserIDMobile, mobileVerifyCode)
if err = err2; err == nil {
if !mobileAuth.IsUserEmpty() {
@@ -113,7 +113,7 @@ func RegisterUser(user *model.User, mobileVerifyCode string, inAuthInfo *auth2.A
} else {
user.Type |= model.UserTypeStoreBoss
}
if err = CreateUser(user, "RegisterUser"); err == nil {
if err = CreateUser(user, utils.LimitUTF8StringLen(ctx.GetRealRemoteIP()+","+inAuthInfo.GetAuthID(), 32)); err == nil {
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
err = auth2.AddAuthBind(&outAuthInfo.UserBasic, inAuthInfo)
}