v1.18.x
Baris Soner Usakli 12 years ago
parent bcb492751c
commit de34c7580f

@ -9,7 +9,9 @@
<label>Site Description</label> <label>Site Description</label>
<input type="text" class="form-control" placeholder="A short description about your community" data-field="description" /><br /> <input type="text" class="form-control" placeholder="A short description about your community" data-field="description" /><br />
<label>Imgur Client ID</label> <label>Imgur Client ID</label>
<input type="text" class="form-control" placeholder="Imgur ClientID for image uploads" data-field="imgurClientID" /> <input type="text" class="form-control" placeholder="Imgur ClientID for image uploads" data-field="imgurClientID" /><br />
<label>Maximum User Image Size</label>
<input type="text" class="form-control" placeholder="Maximum size of uploaded user images in kilobytes" data-field="maximumProfileImageSize" />
</form> </form>
</div> </div>

@ -113,6 +113,9 @@ var async = require('async'),
}, { }, {
field: 'imgurClientID', field: 'imgurClientID',
value: '' value: ''
}, {
field: 'maximumProfileImageSize',
value: 256
}]; }];
async.each(defaults, function (configObj, next) { async.each(defaults, function (configObj, next) {

@ -5,7 +5,8 @@ var user = require('./../user.js'),
utils = require('./../../public/src/utils.js'), utils = require('./../../public/src/utils.js'),
path = require('path'), path = require('path'),
winston = require('winston'), winston = require('winston'),
nconf = require('nconf'); nconf = require('nconf'),
meta = require('./../meta');
(function(User) { (function(User) {
User.create_routes = function(app) { User.create_routes = function(app) {
@ -136,9 +137,11 @@ var user = require('./../user.js'),
if (!req.user) if (!req.user)
return res.redirect('/403'); return res.redirect('/403');
if (req.files.userPhoto.size > 262144) { var uploadSize = meta.config.maximumProfileImageSize || 256;
if (req.files.userPhoto.size > uploadSize * 1024) {
res.send({ res.send({
error: 'Images must be smaller than 256kb!' error: 'Images must be smaller than ' + uploadSize + ' kb!'
}); });
return; return;
} }

Loading…
Cancel
Save