- add GetBindAuthInfo

This commit is contained in:
gazebo
2019-03-04 12:01:59 +08:00
parent c2896a69af
commit d67f09007d
3 changed files with 31 additions and 4 deletions

View File

@@ -157,7 +157,7 @@ func (c *Auth2Controller) Logout() {
// @router /AddAuthBind [post]
func (c *Auth2Controller) AddAuthBind() {
c.callAddAuthBind(func(params *tAuth2AddAuthBindParams) (retVal interface{}, errCode string, err error) {
authInfo, err2 := c.getAuth2Info(params.Ctx)
authInfo, err2 := getAuth2Info(params.Ctx)
if err := err2; err == nil {
newAuthInfo, err2 := auth2.GetTokenInfo(params.AuthToken)
if err = err2; err == nil {
@@ -177,7 +177,7 @@ func (c *Auth2Controller) AddAuthBind() {
// @router /RemoveAuthBind [post]
func (c *Auth2Controller) RemoveAuthBind() {
c.callRemoveAuthBind(func(params *tAuth2RemoveAuthBindParams) (retVal interface{}, errCode string, err error) {
authInfo, err2 := c.getAuth2Info(params.Ctx)
authInfo, err2 := getAuth2Info(params.Ctx)
if err := err2; err == nil {
err = auth2.UnbindAuth(authInfo, params.AuthType)
}
@@ -195,7 +195,7 @@ 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)
authInfo, err := getAuth2Info(params.Ctx)
if err == nil {
err = password.AutherObj.ChangePassword(authInfo.GetID(), params.OldPwd, params.NewPwd)
}
@@ -203,7 +203,7 @@ func (c *Auth2Controller) ChangePassword() {
})
}
func (c *Auth2Controller) getAuth2Info(ctx *jxcontext.Context) (authInfo *auth2.AuthInfo, err error) {
func getAuth2Info(ctx *jxcontext.Context) (authInfo *auth2.AuthInfo, err error) {
if authInfo, ok := ctx.GetLoginInfo().(*auth2.AuthInfo); ok {
return authInfo, err
}