diff --git a/install/data/defaults.json b/install/data/defaults.json index 778dee3838..980e673325 100644 --- a/install/data/defaults.json +++ b/install/data/defaults.json @@ -94,5 +94,9 @@ { "field": "requireEmailConfirmation", "value": 0 + }, + { + "field": "profile:allowProfileImageUploads", + "value": 1 } ] diff --git a/src/controllers/api.js b/src/controllers/api.js index e565963816..367c6eb278 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -44,6 +44,7 @@ apiController.getConfig = function(req, res, next) { config.allowGuestSearching = parseInt(meta.config.allowGuestSearching, 10) === 1; config.allowGuestHandles = parseInt(meta.config.allowGuestHandles, 10) === 1; config.allowFileUploads = parseInt(meta.config.allowFileUploads, 10) === 1; + config.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads) === 1; config.allowTopicsThumbnail = parseInt(meta.config.allowTopicsThumbnail, 10) === 1; config.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1; config.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1; diff --git a/src/user/picture.js b/src/user/picture.js index d726773a55..8f030091a9 100644 --- a/src/user/picture.js +++ b/src/user/picture.js @@ -24,6 +24,9 @@ module.exports = function(User) { var convertToPNG = parseInt(meta.config['profile:convertProfileImageToPNG'], 10) === 1; async.waterfall([ + function(next) { + next(parseInt(meta.config.allowProfileImageUploads) !== 1 ? new Error('[[error:profile-image-uploads-disabled]]') : null); + }, function(next) { next(picture.size > uploadSize * 1024 ? new Error('[[error:file-too-big, ' + uploadSize + ']]') : null); }, @@ -44,7 +47,6 @@ module.exports = function(User) { } } ], function(err, result) { - function done(err, image) { if (err) { return callback(err); diff --git a/src/views/admin/settings/user.tpl b/src/views/admin/settings/user.tpl index ab09e237c8..2db779fe27 100644 --- a/src/views/admin/settings/user.tpl +++ b/src/views/admin/settings/user.tpl @@ -46,6 +46,12 @@