- ErrAuthTypeAlreadyExist

This commit is contained in:
gazebo
2019-03-05 09:20:13 +08:00
parent 10218a6d52
commit dee5524331
4 changed files with 6 additions and 1 deletions

View File

@@ -89,6 +89,7 @@ var (
ErrUserMobileAlreadyExist = errors.New("用户手机已经存在")
ErrUserID2AlreadyExist = errors.New("用户标识已经存在")
ErrUserNotExist = errors.New("用户不存在")
ErrUserAuthTypeNotExist = errors.New("用户登录类型不存在")
ErrIllegalAuthType = errors.New("非法的登录类型")
ErrAuthTypeAlreadyExist = errors.New("要登录类型已经存在")
ErrCaptchaIsNotOk = errors.New("图形校验码不正确")

View File

@@ -37,7 +37,7 @@ func (a *Auther) VerifySecret(userID, passMD5 string) (authBind *model.AuthBind,
if authBind, err = dao.GetAuthBind(dao.GetDB(), "", AuthType, userID); err == nil {
err = a.checkPassword(authBind, passMD5)
} else if dao.IsNoRowsError(err) {
err = auth2.ErrUserNotExist
err = auth2.ErrUserAuthTypeNotExist
}
return authBind, err
}

View File

@@ -61,6 +61,8 @@ func (a *Auther) VerifySecret(state, code string) (authBind *model.AuthBind, err
authBind.AuthID = wxUserinfo.OpenID
authBind.DetailData = string(utils.MustMarshal(wxUserinfo))
err = a.AddAuthBind(authBind, wxUserinfo.NickName)
} else if dao.IsNoRowsError(err) {
err = auth2.ErrUserAuthTypeNotExist
}
}
if err == nil && len(authBindList) == 0 {

View File

@@ -48,6 +48,8 @@ func (a *MiniAuther) VerifySecret(dummy, jsCode string) (authBind *model.AuthBin
authBind.DetailData = string(utils.MustMarshal(sessionInfo))
authBind.UserData = sessionKey
err = a.AddAuthBind(authBind, "admin")
} else if dao.IsNoRowsError(err) {
err = auth2.ErrUserAuthTypeNotExist
}
}
if err == nil && len(authBindList) == 0 {