fix(auth): 移除 wechat.service.ts 中对 bcrypt 的直接依赖
改用 Password VO 生成随机密码哈希,避免 TypeScript 找不到 bcrypt 类型声明的编译错误。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d68d48cb95
commit
c9100d3262
|
|
@ -31,8 +31,8 @@ import { TokenService } from './token.service';
|
||||||
import { EventPublisherService } from './event-publisher.service';
|
import { EventPublisherService } from './event-publisher.service';
|
||||||
import { UserRole, UserStatus } from '../../domain/entities/user.entity';
|
import { UserRole, UserStatus } from '../../domain/entities/user.entity';
|
||||||
import { AuthResult } from './auth.service';
|
import { AuthResult } from './auth.service';
|
||||||
|
import { Password } from '../../domain/value-objects/password.vo';
|
||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import * as bcrypt from 'bcrypt';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WechatService {
|
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({
|
const user = await this.userRepo.create({
|
||||||
phone: null,
|
phone: null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue