Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Patch EMAIL_TOKEN_LIFETIME expiring early

Tuan Dang62f0b3f6dfa6
diff --git a/backend/src/models/token.ts b/backend/src/models/token.ts
index 5481365a06..9569aee0bc 100644
--- a/backend/src/models/token.ts
+++ b/backend/src/models/token.ts
@@ -18,11 +18,16 @@ const tokenSchema = new Schema<IToken>({
},
createdAt: {
type: Date,
- expires: parseInt(EMAIL_TOKEN_LIFETIME),
default: Date.now
}
});
+tokenSchema.index({
+ createdAt: 1
+}, {
+ expireAfterSeconds: parseInt(EMAIL_TOKEN_LIFETIME)
+});
+
const Token = model<IToken>('Token', tokenSchema);
export default Token;