aa
This commit is contained in:
@@ -344,6 +344,18 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AddAuthBindWithMobile(authInfo *AuthInfo, mobile string) (err error) {
|
||||||
|
if handler := authers[authInfo.AuthBindInfo.Type]; handler != nil {
|
||||||
|
user, _ := dao.GetUserByID(dao.GetDB(), "mobile", mobile)
|
||||||
|
authInfo.AuthBindInfo.UserID = user.UserID
|
||||||
|
//handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName())
|
||||||
|
err = handler.AddAuthBind(authInfo.AuthBindInfo, user.GetName())
|
||||||
|
} else {
|
||||||
|
err = ErrIllegalAuthType
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func UnbindAuth(userID, authType, authTypeID, userName 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)
|
globals.SugarLogger.Debugf("UnbindAuth userID:%s, authType:%s, authTypeID:%s, userName:%s", userID, authType, authTypeID, userName)
|
||||||
if handler := authers[authType]; handler != nil {
|
if handler := authers[authType]; handler != nil {
|
||||||
|
|||||||
@@ -142,6 +142,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"],
|
||||||
|
web.ControllerComments{
|
||||||
|
Method: "AddAuthBindWithMobile",
|
||||||
|
Router: `/AddAuthBindWithMobile`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"],
|
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"],
|
||||||
web.ControllerComments{
|
web.ControllerComments{
|
||||||
Method: "ChangePassword",
|
Method: "ChangePassword",
|
||||||
|
|||||||
Reference in New Issue
Block a user