CognxSafeTrack commited on
Commit ·
dd63a2e
1
Parent(s): 804312b
feat: add auth debug logs and trigger fresh deploy
Browse files
apps/api/src/routes/auth.ts
CHANGED
|
@@ -16,6 +16,7 @@ export async function authRoutes(fastify: FastifyInstance) {
|
|
| 16 |
}
|
| 17 |
}, async (request, reply) => {
|
| 18 |
const { email, password, organizationId } = request.body as any;
|
|
|
|
| 19 |
|
| 20 |
// If no organizationId provided, we check for Super Admin in 'default-org-id'
|
| 21 |
// or we need to ask for it.
|
|
@@ -24,6 +25,7 @@ export async function authRoutes(fastify: FastifyInstance) {
|
|
| 24 |
const user = await AuthService.findUserByEmail(email, orgId);
|
| 25 |
|
| 26 |
if (!user || !user.passwordHash) {
|
|
|
|
| 27 |
return reply.code(401).send({ error: 'Unauthorized', message: 'Invalid email or password' });
|
| 28 |
}
|
| 29 |
|
|
|
|
| 16 |
}
|
| 17 |
}, async (request, reply) => {
|
| 18 |
const { email, password, organizationId } = request.body as any;
|
| 19 |
+
logger.info(`[AUTH] Login attempt for ${email} (Org: ${organizationId || 'default'})`);
|
| 20 |
|
| 21 |
// If no organizationId provided, we check for Super Admin in 'default-org-id'
|
| 22 |
// or we need to ask for it.
|
|
|
|
| 25 |
const user = await AuthService.findUserByEmail(email, orgId);
|
| 26 |
|
| 27 |
if (!user || !user.passwordHash) {
|
| 28 |
+
logger.warn(`[AUTH] User not found: ${email} in Org: ${orgId}`);
|
| 29 |
return reply.code(401).send({ error: 'Unauthorized', message: 'Invalid email or password' });
|
| 30 |
}
|
| 31 |
|