fix: 统一重置密码验证码的 scene 常量

This commit is contained in:
zetaloop
2026-04-23 14:58:25 +08:00
parent 86f3490fc2
commit d596d41e1a
3 changed files with 5 additions and 3 deletions
@@ -29,7 +29,7 @@ func NewResetPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Res
func (l *ResetPasswordLogic) ResetPassword(in *pb.ResetPasswordReq) (*pb.ResetPasswordResp, error) {
// todo: add your logic here and delete this line
redisKey := fmt.Sprintf(redisx.VCODE_KEY_PREFIX, in.RequestId, redisx.SCENE_REG, in.Email)
redisKey := fmt.Sprintf(redisx.VCODE_KEY_PREFIX, in.RequestId, redisx.SCENE_RESET_PWD, in.Email)
vcode, err := l.svcCtx.RedisCluster.Get(l.ctx, redisKey).Result()
if err != nil {
logx.Errorf("get reset password vcode from redis failed, err:%v.", err)
@@ -38,6 +38,7 @@ func (l *ResetPasswordLogic) ResetPassword(in *pb.ResetPasswordReq) (*pb.ResetPa
if vcode != in.Vcode {
return nil, errors.New(fmt.Sprintf("user %v reset password failed, invalid vcode.", in.Email))
}
// in.NewPassword is already bcrypt-hashed by the API layer
err = l.svcCtx.UsersModelRW.Users.Update().Where(users.EmailEQ(in.Email)).
SetPasswordHash(in.NewPassword).
Exec(l.ctx)