From 55284236360b1af1a862a398415fcfb0b2f6636b Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 19 Sep 2013 07:55:37 +0100 Subject: [PATCH] Client & Server side validation for posts per page closes #839 - caused a 500 error --- core/client/views/settings.js | 4 ++-- core/server/data/default-settings.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/client/views/settings.js b/core/client/views/settings.js index 81df21ae64..3cbbd9fbfc 100644 --- a/core/client/views/settings.js +++ b/core/client/views/settings.js @@ -171,8 +171,8 @@ .check(email, {message: "Please supply a valid email address", el: $('#email-address')}) .isEmail().len(0, 254); Ghost.Validate - .check(postsPerPage, {message: "Please use a number", el: $('postsPerPage')}) - .isInt(); + .check(postsPerPage, {message: "Please use a number less than 1000", el: $('postsPerPage')}) + .isInt().max(1000); if (Ghost.Validate._errors.length > 0) { Ghost.Validate.handleErrors(); diff --git a/core/server/data/default-settings.json b/core/server/data/default-settings.json index d73607cc52..251f4a4448 100644 --- a/core/server/data/default-settings.json +++ b/core/server/data/default-settings.json @@ -34,7 +34,8 @@ "defaultValue": "6", "validations": { "notNull": true, - "isNumeric": true + "isInt": true, + "max": 1000 } }, "forceI18n": {