Add maxLimit server configuration (#4048)
* Add maxLimit server configuration * Fix maxlimit validation logic to correctly handle maxLimit:0 case
This commit is contained in:
committed by
Florent Vilmart
parent
976da4d715
commit
23bffc8883
@@ -71,6 +71,7 @@ export class Config {
|
||||
this.mount = removeTrailingSlash(mount);
|
||||
this.liveQueryController = cacheInfo.liveQueryController;
|
||||
this.sessionLength = cacheInfo.sessionLength;
|
||||
this.maxLimit = cacheInfo.maxLimit;
|
||||
this.expireInactiveSessions = cacheInfo.expireInactiveSessions;
|
||||
this.generateSessionExpiresAt = this.generateSessionExpiresAt.bind(this);
|
||||
this.generateEmailVerifyTokenExpiresAt = this.generateEmailVerifyTokenExpiresAt.bind(this);
|
||||
@@ -86,6 +87,7 @@ export class Config {
|
||||
revokeSessionOnPasswordReset,
|
||||
expireInactiveSessions,
|
||||
sessionLength,
|
||||
maxLimit,
|
||||
emailVerifyTokenValidityDuration,
|
||||
accountLockout,
|
||||
passwordPolicy,
|
||||
@@ -113,6 +115,8 @@ export class Config {
|
||||
this.validateSessionConfiguration(sessionLength, expireInactiveSessions);
|
||||
|
||||
this.validateMasterKeyIps(masterKeyIps);
|
||||
|
||||
this.validateMaxLimit(maxLimit);
|
||||
}
|
||||
|
||||
static validateAccountLockoutPolicy(accountLockout) {
|
||||
@@ -220,6 +224,12 @@ export class Config {
|
||||
}
|
||||
}
|
||||
|
||||
static validateMaxLimit(maxLimit) {
|
||||
if (maxLimit <= 0) {
|
||||
throw 'Max limit must be a value greater than 0.'
|
||||
}
|
||||
}
|
||||
|
||||
generateEmailVerifyTokenExpiresAt() {
|
||||
if (!this.verifyUserEmails || !this.emailVerifyTokenValidityDuration) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user