init
This commit is contained in:
@ -20,7 +20,7 @@ type (
|
||||
Mobile, Captcha string
|
||||
}
|
||||
Password struct {
|
||||
Mobile, Password string
|
||||
Account, Password string
|
||||
}
|
||||
Platform struct {
|
||||
OpenID string
|
||||
@ -88,13 +88,13 @@ RETURNS:
|
||||
|
||||
// loginForPassword 密码登陆
|
||||
func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams, error) {
|
||||
if !utils.ValidateMobile(params.Password.Mobile) {
|
||||
if !utils.ValidateMobile(params.Password.Account) {
|
||||
return nil, errors.New("手机号码格式异常")
|
||||
}
|
||||
mUserInstance := model3.NewUserInstance()
|
||||
|
||||
isExist, err := model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "mobile", "password", "salt", "status"},
|
||||
model2.NewWhere("mobile", params.Password.Mobile), model2.NewWhere("local", local))
|
||||
model2.NewWhere("mobile", params.Password.Account), model2.NewWhere("local", local))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -13,7 +13,7 @@ type Logout struct {
|
||||
type LogoutHandle func(enterprise *service.SessionEnterprise) *Logout
|
||||
|
||||
func (c *Logout) Launch() error {
|
||||
if c.UID > 0 {
|
||||
if c.SessionEnterprise != nil && c.UID > 0 {
|
||||
service.Publish(config.EventForRedisHashDestroy, config.RedisKeyForAccount, utils.UintToString(c.UID))
|
||||
}
|
||||
return nil
|
||||
|
@ -62,6 +62,7 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
return nil, errors.New("当前手机号码已注册")
|
||||
}
|
||||
mUserInstance.Local.Local = c.local
|
||||
mUserInstance.Source = model2.UserInstanceSourceForLocal
|
||||
mUserInstance.Password = utils.GetRandomString(12)
|
||||
mUserInstance.Mobile = params.Mobile
|
||||
mUserInstance.Password = params.Password
|
||||
|
Reference in New Issue
Block a user