- fix bug in UnionFindAuthBind
This commit is contained in:
@@ -43,7 +43,14 @@ func (a *DefAuther) Logout(authInfo *auth2.AuthInfo) error {
|
||||
func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []string, openID, unionID string, authDetail interface{}) (authBindEx *auth2.AuthBindEx, err error) {
|
||||
db := dao.GetDB()
|
||||
var authBind *model.AuthBind
|
||||
if authBind, err = dao.GetAuthBind(db, "", curAuthType, openID); dao.IsNoRowsError(err) { // 直接找不到
|
||||
if authBind, err = dao.GetAuthBind(db, "", curAuthType, openID); err == nil { // 直接找到了
|
||||
authBindEx = &auth2.AuthBindEx{
|
||||
AuthBind: *authBind,
|
||||
}
|
||||
if authDetail != nil {
|
||||
authBindEx.DetailData = string(utils.MustMarshal(authDetail))
|
||||
}
|
||||
} else if dao.IsNoRowsError(err) { // 直接找不到,尝试unionID
|
||||
if unionID != "" { // 且有unionID
|
||||
var authBindList []*model.AuthBind
|
||||
if authBindList, err = dao.GetAuthBindsByAuthID2(db, unionID, unionAuthTypeList); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
|
||||
|
||||
Reference in New Issue
Block a user