Fix login password retrieval

This commit is contained in:
Hamza-Ayed
2026-04-17 01:57:18 +03:00
parent 02f9f5f25b
commit 1225958898
2 changed files with 2 additions and 1 deletions

View File

@@ -21,4 +21,4 @@ export const AppDataSource = new DataSource({
entities: [__dirname + '/**/*.entity{.ts,.js}'], entities: [__dirname + '/**/*.entity{.ts,.js}'],
migrations: [__dirname + '/migrations/*{.ts,.js}'], migrations: [__dirname + '/migrations/*{.ts,.js}'],
subscribers: [], subscribers: [],
}); });

View File

@@ -102,6 +102,7 @@ export class AuthService {
async login(dto: LoginDto) { async login(dto: LoginDto) {
const user = await this.dataSource.getRepository(User).findOne({ const user = await this.dataSource.getRepository(User).findOne({
where: { email: dto.email, is_active: true }, where: { email: dto.email, is_active: true },
select: ['id', 'email', 'password_hash', 'tenant_id', 'role', 'name'],
}); });
if (!user || !(await this.comparePassword(dto.password, user.password_hash))) { if (!user || !(await this.comparePassword(dto.password, user.password_hash))) {