- fullfill ChangePassword

This commit is contained in:
gazebo
2019-03-04 11:39:11 +08:00
parent b57e698df8
commit dce28f4aa0
2 changed files with 11 additions and 1 deletions

View File

@@ -20,12 +20,17 @@ type Auther struct {
authprovider.DefAuther
}
var (
AutherObj *Auther
)
var (
ErrUserAndPassNotMatch = errors.New("用户名密码不匹配")
)
func init() {
auth2.RegisterAuther(AuthType, new(Auther))
AutherObj = new(Auther)
auth2.RegisterAuther(AuthType, AutherObj)
}
func (a *Auther) VerifySecret(userID, passMD5 string) (authBind *model.AuthBind, err error) {

View File

@@ -8,6 +8,7 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/auth2"
"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/jxcallback/auth"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
@@ -194,6 +195,10 @@ func (c *Auth2Controller) RemoveAuthBind() {
// @router /ChangePassword [put]
func (c *Auth2Controller) ChangePassword() {
c.callChangePassword(func(params *tAuth2ChangePasswordParams) (retVal interface{}, errCode string, err error) {
authInfo, err := c.getAuth2Info(params.Ctx)
if err == nil {
err = password.AutherObj.ChangePassword(authInfo.GetID(), params.OldPwd, params.NewPwd)
}
return retVal, "", err
})
}