This commit is contained in:
邹宗楠
2022-10-17 14:06:23 +08:00
parent 0695aa132c
commit 53fe97cbc1
49 changed files with 78 additions and 225 deletions

View File

@@ -12,7 +12,6 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/dchest/captcha"
)
@@ -171,11 +170,9 @@ func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) {
}
if user != nil {
authInfo.UpdateByIUser(user)
globals.SugarLogger.Debugf("createAuthInfo id:%s, id2:%s, mobile:%s, authInfo:%s", authInfo.GetID(), authInfo.GetID2(), authInfo.GetMobile(), utils.Format4Output(authInfo, true))
} else {
expireDuration = TmpTokenDuration
authInfo.ExpiresAt = time.Now().Add(expireDuration).Unix()
globals.SugarLogger.Debugf("createAuthInfo authInfo:%s", utils.Format4Output(authInfo, true))
}
SetUserInfo(token, authInfo, expireDuration)
return authInfo
@@ -249,7 +246,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
realAuthID = user.GetID()
}
if authBindEx, err = handler.VerifySecret(realAuthID, authSecret); err == nil {
globals.SugarLogger.Debugf("Login authBindEx", utils.Format4Output(authBindEx, false))
if authBindEx == nil { // mobile, email会返回nil表示不会新建AuthBind实体
user = userProvider.GetUser(authID, authIDType)
authBindEx = &AuthBindEx{
@@ -366,7 +362,6 @@ func BindUser(inauthInfo *AuthInfo, user IUser) (outauthInfo *AuthInfo, err erro
// 添加新绑定
func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
globals.SugarLogger.Debugf("AddAuthBind user:%s, newAuthInfo:%s", utils.Format4Output(user, true), utils.Format4Output(newAuthInfo, true))
if user == nil || newAuthInfo == nil {
return ErrInternalErrror
}
@@ -406,7 +401,6 @@ func AddAuthBindWithMobile(authInfo *AuthInfo, mobile string) (err error) {
}
func UnbindAuth(userID, authType, authTypeID, userName string) (err error) {
globals.SugarLogger.Debugf("UnbindAuth userID:%s, authType:%s, authTypeID:%s, userName:%s", userID, authType, authTypeID, userName)
if handler := authers[authType]; handler != nil {
err = handler.UnbindAuth(userID, authType, authTypeID, userName)
} else {
@@ -416,7 +410,6 @@ func UnbindAuth(userID, authType, authTypeID, userName string) (err error) {
}
func Logout(authInfo *AuthInfo) (err error) {
globals.SugarLogger.Debugf("Logout authInfo:%s", utils.Format4Output(authInfo, true))
if handler := authers[authInfo.AuthBindInfo.Type]; handler != nil {
err = handler.Logout(authInfo)
}

View File

@@ -5,7 +5,6 @@ import (
"strings"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
)
type Context struct {
@@ -21,7 +20,6 @@ func NewContext(w http.ResponseWriter, r *http.Request) (ctx *Context) {
r: r,
accessUUID: utils.GetUUID(),
}
globals.SugarLogger.Debugf("NewContext ip:%s", ctx.GetRealRemoteIP())
return ctx
}

View File

@@ -36,7 +36,7 @@ func (a *DefAuther) AddAuthBind(authBindEx *auth2.AuthBindEx, userName string) (
}
func (a *DefAuther) UnbindAuth(userID, authType, authTypeID, userName string) (err error) {
globals.SugarLogger.Debugf("DefAuther.UnbindAuth userID:%s, authType:%s, GetAuthTypeID:%s, userName:%s", userID, authType, authTypeID, userName)
//globals.SugarLogger.Debugf("DefAuther.UnbindAuth userID:%s, authType:%s, GetAuthTypeID:%s, userName:%s", userID, authType, authTypeID, userName)
condition := map[string]interface{}{
"UserID": userID,
"Type": authType,

View File

@@ -32,8 +32,6 @@ func init() {
func (a *TiktopMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) {
globals.SugarLogger.Debugf("toktok mini VerifySecret jsCode:%s", code)
appID, realCode := splitCode(code)
globals.SugarLogger.Debug("appID============", appID)
globals.SugarLogger.Debug("realCode============", realCode)
sessionInfo, err := getTikTokApp(appID).GetTiktokOauth(realCode)
if err != nil {
return nil, err