Open Changes
This commit is contained in:
@@ -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" }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user