mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-05 10:45:37 +02:00
fix: allow setting maximumAboutMeLength to 0
This commit is contained in:
@@ -172,10 +172,10 @@ Configs.cookie = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function processConfig(data) {
|
async function processConfig(data) {
|
||||||
ensurePositiveInteger(data, 'maximumUsernameLength');
|
ensureInteger(data, 'maximumUsernameLength', 1);
|
||||||
ensurePositiveInteger(data, 'minimumUsernameLength');
|
ensureInteger(data, 'minimumUsernameLength', 1);
|
||||||
ensurePositiveInteger(data, 'minimumPasswordLength');
|
ensureInteger(data, 'minimumPasswordLength', 1);
|
||||||
ensurePositiveInteger(data, 'maximumAboutMeLength');
|
ensureInteger(data, 'maximumAboutMeLength', 0);
|
||||||
if (data.minimumUsernameLength > data.maximumUsernameLength) {
|
if (data.minimumUsernameLength > data.maximumUsernameLength) {
|
||||||
throw new Error('[[error:invalid-data]]');
|
throw new Error('[[error:invalid-data]]');
|
||||||
}
|
}
|
||||||
@@ -186,10 +186,10 @@ async function processConfig(data) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensurePositiveInteger(data, field) {
|
function ensureInteger(data, field, min) {
|
||||||
if (data.hasOwnProperty(field)) {
|
if (data.hasOwnProperty(field)) {
|
||||||
data[field] = parseInt(data[field], 10);
|
data[field] = parseInt(data[field], 10);
|
||||||
if (!(data[field] > 0)) {
|
if (!(data[field] >= min)) {
|
||||||
throw new Error('[[error:invalid-data]]');
|
throw new Error('[[error:invalid-data]]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user