mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
dont allow negative or zero pagination values for user setting
This commit is contained in:
@@ -119,7 +119,7 @@ var path = require('path'),
|
|||||||
var motdString,
|
var motdString,
|
||||||
assemble = function() {
|
assemble = function() {
|
||||||
data.motd_class = (parseInt(meta.config.show_motd, 10) === 1 || meta.config.show_motd === undefined) ? '' : ' none';
|
data.motd_class = (parseInt(meta.config.show_motd, 10) === 1 || meta.config.show_motd === undefined) ? '' : ' none';
|
||||||
data.motd_class += (meta.config.motd && meta.config.motd.length > 0 ? '' : ' default');
|
data.motd_class += (meta.config.motd && meta.config.motd.length > 0) ? '' : ' default';
|
||||||
data.motd_class += meta.config.motd_class ? ' ' + meta.config.motd_class : '';
|
data.motd_class += meta.config.motd_class ? ' ' + meta.config.motd_class : '';
|
||||||
|
|
||||||
data.motd = motdString;
|
data.motd = motdString;
|
||||||
|
|||||||
11
src/user.js
11
src/user.js
@@ -216,7 +216,16 @@ var bcrypt = require('bcryptjs'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
User.saveSettings = function(uid, data, callback) {
|
User.saveSettings = function(uid, data, callback) {
|
||||||
db.setObject('user:' + uid + ':settings', data, callback);
|
if(!data.topicsPerPage || !data.postsPerPage || parseInt(data.topicsPerPage, 10) <= 0 || !parseInt(data.postsPerPage, 10) <= 0) {
|
||||||
|
return callback(new Error('Invalid pagination value!'));
|
||||||
|
}
|
||||||
|
|
||||||
|
db.setObject('user:' + uid + ':settings', {
|
||||||
|
showemail: data.showemail,
|
||||||
|
usePagination: data.usePagination,
|
||||||
|
topicsPerPage: data.topicsPerPage,
|
||||||
|
postsPerPage: data.postsPerPage
|
||||||
|
}, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
User.updateProfile = function(uid, data, callback) {
|
User.updateProfile = function(uid, data, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user