- status
This commit is contained in:
@@ -232,29 +232,6 @@ func AddAuthBind(authInfo *AuthInfo, newAuthInfo *AuthInfo) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// func AddAuthBind(authInfo *AuthInfo, authType, authID, authIDType, authSecret string) (err error) {
|
||||
// if authInfo == nil {
|
||||
// return ErrInternalErrror
|
||||
// }
|
||||
// // 密码绑定直接绑定
|
||||
// if authType == AuthTypePassword {
|
||||
// err = authers[AuthTypePassword].AddAuthBind(&model.AuthBind{
|
||||
// UserID: authInfo.GetID(),
|
||||
// Type: AuthTypePassword,
|
||||
// AuthID: authInfo.GetID(),
|
||||
// Status: model.AuthBindStatusNormal,
|
||||
// }, authInfo.GetName())
|
||||
// } else {
|
||||
// tmpauthInfo, err := Login(authType, authID, authIDType, authSecret)
|
||||
// if err == nil {
|
||||
// RemoveUserInfo(tmpauthInfo.Token)
|
||||
// tmpauthInfo.AuthBindInfo.UserID = authInfo.GetID()
|
||||
// err = authers[authType].AddAuthBind(tmpauthInfo.AuthBindInfo, authInfo.GetName())
|
||||
// }
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
|
||||
func UnbindAuth(authInfo *AuthInfo, authType string) (err error) {
|
||||
if handler := authers[authType]; handler != nil {
|
||||
err = handler.UnbindAuth(authInfo, authType)
|
||||
|
||||
@@ -15,6 +15,7 @@ type DefAuther struct {
|
||||
// 此函数为空
|
||||
func (a *DefAuther) AddAuthBind(authBind *model.AuthBind, userName string) (err error) {
|
||||
dao.WrapAddIDCULDEntity(authBind, userName)
|
||||
authBind.Status = model.AuthBindStatusNormal
|
||||
err = dao.CreateEntity(nil, authBind)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ func RegisterUser(user *model.User, mobileVerifyCode string, inAuthInfo *auth2.A
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(user, "RegisterUser")
|
||||
user.UserID = utils.GetUUID()
|
||||
user.Status = model.UserStatusNormal
|
||||
if err = dao.CreateEntity(nil, user); err == nil {
|
||||
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {
|
||||
err = auth2.AddAuthBind(outAuthInfo, inAuthInfo)
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package model
|
||||
|
||||
const (
|
||||
UserStatusNormal = 1
|
||||
UserStatusDisabled = 2
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ModelIDCULD
|
||||
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
||||
|
||||
Reference in New Issue
Block a user