- fk
This commit is contained in:
@@ -177,7 +177,7 @@ func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo,
|
||||
if handler := authers[authType]; handler != nil {
|
||||
var authBind *model.AuthBind
|
||||
var user IUser
|
||||
realauthID := authID
|
||||
realAuthID := authID
|
||||
if authIDType == AuthTypePassword {
|
||||
if authID == "" {
|
||||
return nil, ErrInvalidParams
|
||||
@@ -185,9 +185,9 @@ func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo,
|
||||
if user = userProvider.GetUser(authID, authIDType); user == nil {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
realauthID = user.GetID()
|
||||
realAuthID = user.GetID()
|
||||
}
|
||||
if authBind, err = handler.VerifySecret(realauthID, authSecret); err == nil {
|
||||
if authBind, err = handler.VerifySecret(realAuthID, authSecret); err == nil {
|
||||
if authBind == nil { // mobile, email会返回nil(表示不会新建AuthBind实体)
|
||||
user = userProvider.GetUser(authID, authIDType)
|
||||
authBind = &model.AuthBind{
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -34,6 +35,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (a *Auther) VerifySecret(userID, passMD5 string) (authBind *model.AuthBind, err error) {
|
||||
globals.SugarLogger.Debugf("localpass VerifySecret userID:%s", userID)
|
||||
if authBind, err = dao.GetAuthBind(dao.GetDB(), "", AuthType, userID); err == nil {
|
||||
err = a.checkPassword(authBind, passMD5)
|
||||
} else if dao.IsNoRowsError(err) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
func GetAuthBind(db *DaoDB, userID, authType, authID string) (authBind *model.AuthBind, err error) {
|
||||
@@ -31,6 +32,7 @@ func GetAuthBind(db *DaoDB, userID, authType, authID string) (authBind *model.Au
|
||||
sql += " AND t1.auth_id = ?"
|
||||
sqlParams = append(sqlParams, authID)
|
||||
}
|
||||
globals.SugarLogger.Debugf("GetAuthBind sql:%s, sqlParams:%s", sql, utils.Format4Output(sqlParams, false))
|
||||
err = GetRow(db, &authBind, sql, sqlParams...)
|
||||
return authBind, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user