check for blank usrrname in guestbook (like " ")

This commit is contained in:
b1ek 2023-03-18 13:11:11 +10:00
parent cd768de17a
commit 3b87f14199
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ async function submit(req, res, next) {
if (message.length >= 512) {
errors.push('Maximum length is 512 characters.');
}
if (name == '') {
if (name.match(/^\s*$/g)) {
errors.push('Name must be specified.');
}
if (
@ -65,12 +65,12 @@ async function submit(req, res, next) {
send_error(res, "<p>" + errors.join('<br/>') + "</p>");
return;
}
// done checking for errors
req.session.gb_name = name;
req.session.gb_email = email;
req.session.gb_hidemail = req.body.hidemail;
// actual shit
let records = await Sequelize.Guestbook.findAll({
where: {
ip: req.ip