diff --git a/backend/services/auth-service/src/application/services/wechat.service.ts b/backend/services/auth-service/src/application/services/wechat.service.ts index ed531ab..2bea9de 100644 --- a/backend/services/auth-service/src/application/services/wechat.service.ts +++ b/backend/services/auth-service/src/application/services/wechat.service.ts @@ -31,8 +31,8 @@ import { TokenService } from './token.service'; import { EventPublisherService } from './event-publisher.service'; import { UserRole, UserStatus } from '../../domain/entities/user.entity'; import { AuthResult } from './auth.service'; +import { Password } from '../../domain/value-objects/password.vo'; import * as crypto from 'crypto'; -import * as bcrypt from 'bcrypt'; @Injectable() export class WechatService { @@ -109,7 +109,9 @@ export class WechatService { } // ── 新用户:自动注册 ── - const randomPasswordHash = await bcrypt.hash(crypto.randomBytes(32).toString('hex'), 10); + // 使用 Password VO 生成随机哈希(微信用户无需密码登录) + const randomPw = await Password.create(crypto.randomBytes(32).toString('hex')); + const randomPasswordHash = randomPw.value; const user = await this.userRepo.create({ phone: null,