dd
This commit is contained in:
@@ -251,6 +251,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
|
||||
globals.SugarLogger.Debugf("Login authBindEx", utils.Format4Output(authBindEx, false))
|
||||
if authBindEx == nil { // mobile, email会返回nil(表示不会新建AuthBind实体)
|
||||
user = userProvider.GetUser(authID, authIDType)
|
||||
globals.SugarLogger.Debug("user第一次===================", user)
|
||||
authBindEx = &AuthBindEx{
|
||||
AuthBind: model.AuthBind{
|
||||
Type: authType,
|
||||
@@ -277,6 +278,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
|
||||
} else if authBindEx.UserID != "" {
|
||||
user = userProvider.GetUser(authBindEx.UserID, UserIDID)
|
||||
}
|
||||
globals.SugarLogger.Debug("user第二次=============", user)
|
||||
}
|
||||
globals.SugarLogger.Debug("输出authBindEx,user", authBindEx, user)
|
||||
authInfo = createAuthInfo(user, authBindEx)
|
||||
|
||||
@@ -75,9 +75,6 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
|
||||
if authDetail != nil {
|
||||
authBindEx.DetailData = string(utils.MustMarshal(authDetail))
|
||||
}
|
||||
globals.SugarLogger.Debug("检查一下数据样式===================", authBindEx)
|
||||
globals.SugarLogger.Debug("检查一下数据样式===================", authDetail)
|
||||
globals.SugarLogger.Debug("检查一下数据样式===================", authBindEx.DetailData)
|
||||
if authBind.TypeID == "" {
|
||||
authBind.TypeID = curAuthTypeID
|
||||
dao.UpdateEntity(db, authBind, "TypeID")
|
||||
@@ -85,16 +82,11 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
|
||||
} else if dao.IsNoRowsError(err) { // 直接找不到,尝试unionID
|
||||
if unionID != "" || openID != "" { // 且有unionID
|
||||
var authBindList []*model.AuthBind
|
||||
globals.SugarLogger.Debug("输出一下", unionAuthTypeList)
|
||||
globals.SugarLogger.Debug("=====================输出一下model.AuthBindTypeAuth,openID,unionID", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID)
|
||||
authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID, nil)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debug("authBindList输出错误", err)
|
||||
return nil, err
|
||||
}
|
||||
globals.SugarLogger.Debug("检测这个authBindList", authBindList)
|
||||
if len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
|
||||
globals.SugarLogger.Debug("进入authBindList, err = dao.GetUserBindAuthInfo 这里了")
|
||||
authBind = authBindList[0]
|
||||
authBind.Type = curAuthType
|
||||
authBind.TypeID = curAuthTypeID
|
||||
@@ -105,20 +97,16 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
|
||||
authBindEx = &auth2.AuthBindEx{
|
||||
AuthBind: *authBind,
|
||||
}
|
||||
globals.SugarLogger.Debug("输出赋值后的authBind.DetailData", authBind.DetailData)
|
||||
globals.SugarLogger.Debug("输出赋值后的authBindEx", authBindEx)
|
||||
a.UnbindAuth(authBind.UserID, curAuthType, curAuthTypeID, model.AdminName)
|
||||
err = a.AddAuthBind(authBindEx, model.AdminName) // 自动绑定
|
||||
} else if dao.IsNoRowsError(err) {
|
||||
err = nil
|
||||
}
|
||||
globals.SugarLogger.Debug("输出一下authBindList", authBindList) //空的
|
||||
} else {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
if err == nil && authBindEx == nil { //如果没有报错,且没有找到一个认证方式,创建无用户(UserID为空)的认证方式
|
||||
globals.SugarLogger.Debug("没有找到一个认证方式")
|
||||
authBindEx = &auth2.AuthBindEx{
|
||||
AuthBind: model.AuthBind{
|
||||
Type: curAuthType,
|
||||
@@ -127,8 +115,6 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
|
||||
AuthID2: unionID,
|
||||
},
|
||||
}
|
||||
globals.SugarLogger.Debug("输出一下authBindEx", authBindEx)
|
||||
globals.SugarLogger.Debug("===================再输出一下authBind", authBind)
|
||||
if authDetail != nil {
|
||||
authBindEx.DetailData = string(utils.MustMarshal(authDetail))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user