fix: #7576 "Disable password changes" can be sidestepped

v1.18.x
Andrew Rodrigues 6 years ago
parent e114b16d7a
commit 50260e137a

@ -40,6 +40,10 @@ Controllers.errors = require('./errors');
Controllers.composer = require('./composer');
Controllers.reset = function (req, res, next) {
if (meta.config['password:disableEdit']) {
return helpers.notAllowed(req, res);
}
res.locals.metaTags = {
...res.locals.metaTags,
name: 'robots',
@ -120,6 +124,7 @@ Controllers.login = function (req, res, next) {
}]);
data.error = req.flash('error')[0] || errorText;
data.title = '[[pages:login]]';
data.allowPasswordReset = !meta.config['password:disableEdit'];
privileges.global.canGroup('local:login', 'registered-users', function (err, hasLoginPrivilege) {
if (err) {

@ -100,6 +100,10 @@ SocketUser.reset.send = function (socket, email, callback) {
return callback(new Error('[[error:invalid-data]]'));
}
if (meta.config['password:disableEdit']) {
return callback(new Error('[[error:no-privileges]]'));
}
user.reset.send(email, function (err) {
events.log({
type: 'password-reset',

Loading…
Cancel
Save