added new requirements for lessons and units

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-15 16:26:09 +08:00
parent b7d62b3b18
commit 9c82b0de09
25 changed files with 1569 additions and 233 deletions
+13 -2
View File
@@ -28,8 +28,19 @@
const csurf = require('csurf');
const R = require('../utils/response.util');
/** csurf instance — stores token in a signed cookie */
const csrfProtection = csurf({ cookie: { httpOnly: true, sameSite: 'strict' } });
/**
* csurf instance — stores token in a signed cookie.
* sameSite:'none' (not 'strict') in production — frontend (Vercel) and this
* API (Render) are cross-site, so 'strict' drops the cookie on every
* fetch/XHR call. 'none' requires secure:true, set alongside it below.
*/
const csrfProtection = csurf({
cookie: {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
},
});
/**
* GET /api/csrf-token