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