check for blank usrrname in guestbook (like " ")
This commit is contained in:
parent
cd768de17a
commit
3b87f14199
|
@ -46,7 +46,7 @@ async function submit(req, res, next) {
|
||||||
if (message.length >= 512) {
|
if (message.length >= 512) {
|
||||||
errors.push('Maximum length is 512 characters.');
|
errors.push('Maximum length is 512 characters.');
|
||||||
}
|
}
|
||||||
if (name == '') {
|
if (name.match(/^\s*$/g)) {
|
||||||
errors.push('Name must be specified.');
|
errors.push('Name must be specified.');
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
@ -65,12 +65,12 @@ async function submit(req, res, next) {
|
||||||
send_error(res, "<p>" + errors.join('<br/>') + "</p>");
|
send_error(res, "<p>" + errors.join('<br/>') + "</p>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// done checking for errors
|
||||||
|
|
||||||
req.session.gb_name = name;
|
req.session.gb_name = name;
|
||||||
req.session.gb_email = email;
|
req.session.gb_email = email;
|
||||||
req.session.gb_hidemail = req.body.hidemail;
|
req.session.gb_hidemail = req.body.hidemail;
|
||||||
|
|
||||||
// actual shit
|
|
||||||
let records = await Sequelize.Guestbook.findAll({
|
let records = await Sequelize.Guestbook.findAll({
|
||||||
where: {
|
where: {
|
||||||
ip: req.ip
|
ip: req.ip
|
||||||
|
|
Loading…
Reference in New Issue