feat: Implement AI Chat Agent, Email Notifications, and UI enhancements
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-12-12 08:35:48 +01:00
parent ccfb674318
commit 5d8976b1cd
58 changed files with 7867 additions and 844 deletions
+10 -4
View File
@@ -15,7 +15,7 @@ export async function hashPassword(password: string) {
return `${buf.toString("hex")}.${salt}`;
}
async function comparePassword(supplied: string, stored: string) {
export async function comparePassword(supplied: string, stored: string) {
const [hashed, salt] = stored.split(".");
const hashedBuf = Buffer.from(hashed, "hex");
const suppliedBuf = (await scryptAsync(supplied, salt, 64)) as Buffer;
@@ -28,11 +28,14 @@ export function setupAuth(app: Express) {
resave: false,
saveUninitialized: false,
store: storage.sessionStore,
cookie: {
secure: process.env.NODE_ENV === "production" && process.env.SECURE_COOKIES === "true",
sameSite: "lax",
// maxAge not set by default (session cookie)
},
};
if (app.get("env") === "production") {
app.set("trust proxy", 1);
}
app.use(session(sessionSettings));
app.use(passport.initialize());
@@ -128,6 +131,9 @@ export function setupAuth(app: Express) {
});
app.post("/api/login", passport.authenticate("local"), (req, res) => {
if (req.body.rememberMe) {
req.session.cookie.maxAge = 30 * 24 * 60 * 60 * 1000; // 30 days
}
res.status(200).json(req.user);
});