fix: 统一重置密码验证码的 scene 常量
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user