add max length server side check

This commit is contained in:
b1ek 2023-02-20 15:34:26 +10:00
parent c3bc8d767e
commit f803aaa453
1 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,11 @@ async function submit(req, res, next) {
const { name, email, message } = req.body;
const hidemail = req.body.hidemail ? (req.body.hidemail == 'on' ? true : false) : false;
if (message.length >= 512) {
res.redirect('/guestbook?error=' + encodeURIComponent('Maximum length is 512 characters.'));
return;
}
let data = await Sequelize.Guestbook.create({
name,
email,