param
This commit is contained in:
@@ -161,7 +161,6 @@ func getFixedTokenName(token string) *AuthInfo {
|
||||
func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) {
|
||||
token, tokenType := createToken(user, authBindInfo)
|
||||
//user为空 tokenType=2
|
||||
globals.SugarLogger.Debug("token,tokenType,user============", token, tokenType, user)
|
||||
expireDuration := DefTokenDuration
|
||||
authInfo = &AuthInfo{
|
||||
AuthBindInfo: authBindInfo,
|
||||
@@ -249,7 +248,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
|
||||
}
|
||||
realAuthID = user.GetID()
|
||||
}
|
||||
globals.SugarLogger.Debug("打印realAuthID检测是否为空==================", realAuthID)
|
||||
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实体)
|
||||
@@ -282,7 +280,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
|
||||
}
|
||||
}
|
||||
authInfo = createAuthInfo(user, authBindEx)
|
||||
globals.SugarLogger.Debug("authInfo==================", authInfo)
|
||||
if user != nil && user.GetID() != "" {
|
||||
userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP())
|
||||
}
|
||||
@@ -378,14 +375,12 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
|
||||
}
|
||||
RemoveUserInfo(newAuthInfo.Token)
|
||||
if newAuthInfo.AuthBindInfo.Type == AuthTypeMobile {
|
||||
globals.SugarLogger.Debug("进入AuthTypeMobile,输出newAuthInfo.AuthBindInfo.AuthID", newAuthInfo.AuthBindInfo.AuthID)
|
||||
err = userProvider.UpdateUserMobile(user.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
} else if newAuthInfo.AuthBindInfo.Type == AuthTypeEmail {
|
||||
err = userProvider.UpdateUserEmail(user.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
} else {
|
||||
if handler := authers[newAuthInfo.AuthBindInfo.Type]; handler != nil {
|
||||
newAuthInfo.AuthBindInfo.UserID = user.GetID()
|
||||
globals.SugarLogger.Debug("进入AddAuthBind获取userID", newAuthInfo.AuthBindInfo.UserID)
|
||||
handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName())
|
||||
err = handler.AddAuthBind(newAuthInfo.AuthBindInfo, user.GetName())
|
||||
} else {
|
||||
@@ -398,7 +393,6 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
|
||||
func AddAuthBindWithMobile(authInfo *AuthInfo, mobile string) (err error) {
|
||||
if handler := authers[authInfo.AuthBindInfo.Type]; handler != nil {
|
||||
user, err := dao.GetUserByID(dao.GetDB(), "mobile", mobile)
|
||||
globals.SugarLogger.Debug("user===============", user)
|
||||
if err != nil {
|
||||
return errors.New("此接口有执行顺序,请先调用注册登录接口:【第一步:Login,第二不:TiktokDecrypt】")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user