|
|
|
@ -94,15 +94,15 @@ func (s *userImpl) GetAdminUserByUsernamePassword(ctx context.Context, req *syst
|
|
|
|
|
user, err = s.GetUserByUsername(ctx, req.Username) |
|
|
|
|
liberr.ErrIsNil(ctx, err) |
|
|
|
|
liberr.ValueIsNil(user, "账号密码错误") |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetAdminUserByUsernamePassword >>> Username:%s, Password: %s", req.Username, req.Password) |
|
|
|
|
//验证密码
|
|
|
|
|
if libUtils.EncryptPassword(req.Password, user.UserSalt) != user.UserPassword { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号密码错误")) |
|
|
|
|
} |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -112,6 +112,10 @@ func (s *userImpl) GetAdminUserByPhone(ctx context.Context, req *system.UserLogi
|
|
|
|
|
user, err = s.GetUserByMobile(ctx, req.Phone) |
|
|
|
|
liberr.ErrIsNil(ctx, err) |
|
|
|
|
liberr.ValueIsNil(user, "手机验证码错误") |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetAdminUserByPhone >>> Phone:%s", req.Phone) |
|
|
|
|
//验证密码
|
|
|
|
|
model, ok := codes[req.Phone] |
|
|
|
@ -122,10 +126,6 @@ func (s *userImpl) GetAdminUserByPhone(ctx context.Context, req *system.UserLogi
|
|
|
|
|
if libUtils.EncryptPassword(req.Code+fmt.Sprint(model.Time.Unix()), user.UserSalt) != model.Password { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("手机验证码错误")) |
|
|
|
|
} |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -135,6 +135,10 @@ func (s *userImpl) GetAdminUserByEmail(ctx context.Context, req *system.UserLogi
|
|
|
|
|
user, err = s.GetUserByEmail(ctx, req.Email) |
|
|
|
|
liberr.ErrIsNil(ctx, err) |
|
|
|
|
liberr.ValueIsNil(user, "验证码错误") |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetAdminUserByPhone >>> Email:%s", req.Email) |
|
|
|
|
//验证密码
|
|
|
|
|
model, ok := codes[req.Email] |
|
|
|
@ -145,10 +149,6 @@ func (s *userImpl) GetAdminUserByEmail(ctx context.Context, req *system.UserLogi
|
|
|
|
|
if libUtils.EncryptPassword(req.Code+fmt.Sprint(model.Time.Unix()), user.UserSalt) != model.Password { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("验证码错误")) |
|
|
|
|
} |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -189,6 +189,10 @@ func (s *userImpl) GetCodeByMobile(ctx context.Context, mobile string) (code str
|
|
|
|
|
user, err := s.GetUserByMobile(ctx, mobile) |
|
|
|
|
liberr.ErrIsNil(ctx, err) |
|
|
|
|
liberr.ValueIsNil(user, "手机验证码错误") |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetCodeByMobile >>> Phone:%s", mobile) |
|
|
|
|
code = utils.GenerateRandomString(4) |
|
|
|
|
//验证密码
|
|
|
|
@ -201,10 +205,6 @@ func (s *userImpl) GetCodeByMobile(ctx context.Context, mobile string) (code str
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.Printf("GetCodeByMobile >>> Phone:%s", gjson.MustEncodeString(codes[mobile])) |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -215,6 +215,10 @@ func (s *userImpl) GetCodeByEmail(ctx context.Context, email string) (code strin
|
|
|
|
|
user, err := s.GetUserByEmail(ctx, email) |
|
|
|
|
liberr.ErrIsNil(ctx, err) |
|
|
|
|
liberr.ValueIsNil(user, "验证码错误") |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetCodeByMobile >>> email:%s", email) |
|
|
|
|
code = utils.GenerateRandomString(6) |
|
|
|
|
//验证密码
|
|
|
|
@ -227,10 +231,6 @@ func (s *userImpl) GetCodeByEmail(ctx context.Context, email string) (code strin
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.Printf("GetCodeByMobile >>> email:%s", gjson.MustEncodeString(codes[email])) |
|
|
|
|
//账号状态
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|