|
|
|
@ -120,6 +120,10 @@ func initUserStatus() {
|
|
|
|
|
keys = append(keys, k) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for _, v := range keys { |
|
|
|
|
delete(userStatus, v) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s *userImpl) NotCheckAuthAdminIds(ctx context.Context) *gset.Set { |
|
|
|
@ -150,6 +154,7 @@ func (s *userImpl) GetAdminUserByUsernamePassword(ctx context.Context, req *syst
|
|
|
|
|
if libUtils.EncryptPassword(req.Password, user.UserSalt) != user.UserPassword { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号密码错误")) |
|
|
|
|
} |
|
|
|
|
delete(userStatus, req.Username) |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -168,7 +173,7 @@ func (s *userImpl) GetAdminUserByPhone(ctx context.Context, req *system.UserLogi
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetAdminUserByPhone >>> Phone:%s", req.Phone) |
|
|
|
|
//log.Printf("GetAdminUserByPhone >>> Phone:%s", req.Phone)
|
|
|
|
|
//验证密码
|
|
|
|
|
model, ok := codes[req.Phone] |
|
|
|
|
if !ok || model.Time.Add(expTime*time.Minute).Unix() < gtime.Now().Unix() { |
|
|
|
@ -180,6 +185,9 @@ 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("手机验证码错误")) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
delete(userStatus, req.Phone) |
|
|
|
|
delete(userStatus, user.UserName) |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -198,11 +206,11 @@ func (s *userImpl) GetAdminUserByEmail(ctx context.Context, req *system.UserLogi
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetAdminUserByEmail >>> Email:%s", req.Email) |
|
|
|
|
//log.Printf("GetAdminUserByEmail >>> Email:%s", req.Email)
|
|
|
|
|
//验证密码
|
|
|
|
|
model, ok := codes[req.Email] |
|
|
|
|
if !ok || model.Time.Add(expTime*time.Minute).Unix() < gtime.Now().Unix() { |
|
|
|
|
if !ok { |
|
|
|
|
if ok { |
|
|
|
|
log.Printf("GetAdminUserByEmail >>> Email:%s, time %s ", req.Email, fmt.Sprint(model.Time.Unix())+"--"+fmt.Sprint(gtime.Now().Unix())) |
|
|
|
|
} |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("验证码错误")) |
|
|
|
@ -210,6 +218,9 @@ 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("验证码错误")) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
delete(userStatus, req.Email) |
|
|
|
|
delete(userStatus, user.UserName) |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -254,7 +265,7 @@ func (s *userImpl) GetCodeByMobile(ctx context.Context, mobile string) (code str
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetCodeByMobile >>> Phone:%s", mobile) |
|
|
|
|
//log.Printf("GetCodeByMobile >>> Phone:%s", mobile)
|
|
|
|
|
code = utils.GenerateRandomString(4) |
|
|
|
|
//验证密码
|
|
|
|
|
time := gtime.Now() |
|
|
|
@ -280,7 +291,7 @@ func (s *userImpl) GetCodeByEmail(ctx context.Context, email string) (code strin
|
|
|
|
|
if user.UserStatus == 0 { |
|
|
|
|
liberr.ErrIsNil(ctx, gerror.New("账号已被冻结")) |
|
|
|
|
} |
|
|
|
|
log.Printf("GetCodeByMobile >>> email:%s", email) |
|
|
|
|
//log.Printf("GetCodeByMobile >>> email:%s", email)
|
|
|
|
|
code = utils.GenerateRandomString(6) |
|
|
|
|
//验证密码
|
|
|
|
|
time := gtime.Now() |
|
|
|
|