This commit is contained in:
2025-12-31 19:55:43 +01:00
parent 8260bf7baf
commit 167e82a52b
66 changed files with 5124 additions and 228 deletions

View File

@@ -0,0 +1,18 @@
import { CanActivate, ExecutionContext, Injectable, ForbiddenException } from '@nestjs/common';
@Injectable()
export class ProductionGuard implements CanActivate {
async canActivate(context: ExecutionContext): Promise<boolean> {
const request = context.switchToHttp().getRequest();
const path = request.path;
// Block demo login in production
if (path === '/auth/demo-login' || path === '/api/auth/demo-login') {
if (process.env.NODE_ENV === 'production') {
throw new ForbiddenException('Demo login is not available in production');
}
}
return true;
}
}