fix: escape config.userLang/acpLang, don't allow invalid language codes

This commit is contained in:
Barış Soner Uşaklı
2020-01-13 12:27:50 -05:00
parent df5e3a7394
commit e06c1bfcd2
4 changed files with 35 additions and 10 deletions

View File

@@ -1550,6 +1550,21 @@ describe('User', function () {
});
});
it('should error if language is invalid', function (done) {
var data = {
uid: testUid,
settings: {
userLang: '<invalid-string>',
topicsPerPage: '10',
postsPerPage: '5',
},
};
socketUser.saveSettings({ uid: testUid }, data, function (err) {
assert.equal(err.message, '[[error:invalid-language]]');
done();
});
});
it('should set moderation note', function (done) {
var adminUid;
async.waterfall([