Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
HttpStatus,
} from '@nestjs/common';
import { Response } from 'express';
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';
import { CurrentUser } from '../auth/decorators/current-user.decorator';
import { Roles } from '../auth/decorators/roles.decorator';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
Expand All @@ -38,6 +39,7 @@ import {
} from './dto/admin.dto';
import { RestoreBackupDto, UpdateBackupScheduleDto } from '../backup/dto/backup.dto';

@ApiTags('Admin')
@Controller('admin')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.ADMIN)
Expand Down
14 changes: 7 additions & 7 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1310,13 +1310,13 @@ export class AuthService {
take: passwordHistoryLimit,
});

for (const historyEntry of recentPasswords) {
const isReused = await comparePassword(data.newPassword, historyEntry.passwordHash);
if (isReused) {
throw new BadRequestException(
`Password reuse is not allowed for the last ${passwordHistoryLimit} passwords`,
);
}
const reuseResults = await Promise.all(
recentPasswords.map((entry) => comparePassword(data.newPassword, entry.passwordHash)),
);
if (reuseResults.some(Boolean)) {
throw new BadRequestException(
`Password reuse is not allowed for the last ${passwordHistoryLimit} passwords`,
);
}

const newPasswordHash = await hashPassword(data.newPassword, this.bcryptRounds);
Expand Down
2 changes: 2 additions & 0 deletions src/properties/properties.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import {
import { CreateAmenityDto, UpdateAmenityDto } from './dto/amenity.dto';
import { PropertyReportService } from './report/property-report.service';
import { Response } from 'express';
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';

@ApiTags('Properties')
@Controller('properties')
export class PropertiesController {
constructor(
Expand Down