RegisterUser支持token

This commit is contained in:
gazebo
2020-01-06 16:36:52 +08:00
parent fda22fa2d4
commit 170cd63936
5 changed files with 58 additions and 22 deletions

View File

@@ -13,7 +13,6 @@ import (
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/password"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego"
)
@@ -67,13 +66,13 @@ func (c *Auth2Controller) CreateCaptcha() {
// @router /SendVerifyCode [post]
func (c *Auth2Controller) SendVerifyCode() {
c.callSendVerifyCode(func(params *tAuth2SendVerifyCodeParams) (retVal interface{}, errCode string, err error) {
code, authInfo, err := auth2.SendVerifyCode(params.AuthToken, params.CaptchaID, params.CaptchaValue, params.AuthID)
if err == nil && authInfo != nil {
user, err2 := dao.GetUserByID(dao.GetDB(), "user_id", authInfo.GetID())
if err2 == nil && user.Type&(model.UserTypeBoss|model.UserTypeOperator) != 0 {
retVal = code
}
}
_, _, err = auth2.SendVerifyCode(params.AuthToken, params.CaptchaID, params.CaptchaValue, params.AuthID)
// if err == nil && authInfo != nil {
// user, err2 := dao.GetUserByID(dao.GetDB(), "user_id", authInfo.GetID())
// if err2 == nil && user.Type&(model.UserTypeBoss|model.UserTypeOperator) != 0 {
// retVal = code
// }
// }
return retVal, "", err
})
}