add max length server side check
This commit is contained in:
parent
c3bc8d767e
commit
f803aaa453
|
@ -43,6 +43,11 @@ async function submit(req, res, next) {
|
||||||
const { name, email, message } = req.body;
|
const { name, email, message } = req.body;
|
||||||
const hidemail = req.body.hidemail ? (req.body.hidemail == 'on' ? true : false) : false;
|
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({
|
let data = await Sequelize.Guestbook.create({
|
||||||
name,
|
name,
|
||||||
email,
|
email,
|
||||||
|
|
Loading…
Reference in New Issue