Open Changes

This commit is contained in:
2025-12-05 11:49:33 +01:00
parent d6badafeb9
commit 407592680a
10 changed files with 1493 additions and 28 deletions

View File

@@ -97,7 +97,7 @@ export default async function authRoutes(server: FastifyInstance) {
const { data, error } = await server.supabase
.from("auth_users")
.select("*, tenants!auth_tenant_users(*)")
.eq("email", body.email)
.eq("email", body.email.toLowerCase())
// @ts-ignore
user = (data || []).find(i => i.tenants.find(x => x.id === req.tenant.id))
@@ -130,7 +130,7 @@ export default async function authRoutes(server: FastifyInstance) {
return reply.code(401).send({ error: "Invalid credentials" });
} else {
const token = jwt.sign(
{ user_id: user.id, email: user.email, tenant_id: req.tenant?.id ? req.tenant.id : null },
{ user_id: user.id, email: user.email, tenant_id: null },
secrets.JWT_SECRET!,
{ expiresIn: "6h" }
);