diff --git a/app.js b/app.js index 1c3d416..b58cf8d 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,6 @@ let fs = require('fs'), path = require('path'); +const serializejs = require('serialize-javascript'); const commandLineArgs = require('command-line-args'); const optionDefinitions = [ @@ -52,6 +53,7 @@ global.syzoj = { // Use cookie parser app.use(require('cookie-parser')()); + app.locals.serializejs = serializejs; let multer = require('multer'); app.multer = multer({ dest: syzoj.utils.resolvePath(syzoj.config.upload_dir, 'tmp') }); diff --git a/package.json b/package.json index 3802959..d32594a 100644 --- a/package.json +++ b/package.json @@ -43,12 +43,12 @@ "jsondiffpatch": "0.2.5", "jsonwebtoken": "^8.4.0", "katex": "^0.10.0", + "mariadb": "^2.0.2-rc", "mathjax-node": "^2.1.1", "moemark": "^0.3.10", - "moment": "^2.23.0", + "moment": "^2.24.0", "msgpack-lite": "^0.1.26", "multer": "^1.2.0", - "mariadb": "^2.0.2-rc", "node-7z": "^0.4.0", "nodemailer": "^4.7.0", "object-assign-deep": "^0.4.0", @@ -58,6 +58,7 @@ "request-promise": "^4.1.1", "sendmail": "^1.1.1", "sequelize": "^5.0.0-beta.15", + "serialize-javascript": "^1.6.1", "session-file-store": "^1.0.0", "socket.io": "^2.2.0", "stream-to-string": "^1.1.0", diff --git a/views/admin_links.ejs b/views/admin_links.ejs index 4fb8e51..14480a3 100644 --- a/views/admin_links.ejs +++ b/views/admin_links.ejs @@ -62,7 +62,7 @@ this.adminPage = 'links'; + diff --git a/views/forget_confirm.ejs b/views/forget_confirm.ejs index ba01a5e..e48d26d 100644 --- a/views/forget_confirm.ejs +++ b/views/forget_confirm.ejs @@ -50,7 +50,7 @@ function submitForm() { url: "/api/reset_password", type: 'POST', data: { - "token": <%- JSON.stringify(token) %>, + "token": <%- serializejs(token) %>, "password": password }, async: true, diff --git a/views/index.ejs b/views/index.ejs index e31aa09..be4351c 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -56,7 +56,7 @@