| 393 | } |
| 394 | |
| 395 | static validateAccountLockoutPolicy(accountLockout) { |
| 396 | if (accountLockout) { |
| 397 | if ( |
| 398 | typeof accountLockout.duration !== 'number' || |
| 399 | accountLockout.duration <= 0 || |
| 400 | accountLockout.duration > 99999 |
| 401 | ) { |
| 402 | throw 'Account lockout duration should be greater than 0 and less than 100000'; |
| 403 | } |
| 404 | |
| 405 | if ( |
| 406 | !Number.isInteger(accountLockout.threshold) || |
| 407 | accountLockout.threshold < 1 || |
| 408 | accountLockout.threshold > 999 |
| 409 | ) { |
| 410 | throw 'Account lockout threshold should be an integer greater than 0 and less than 1000'; |
| 411 | } |
| 412 | |
| 413 | if (accountLockout.unlockOnPasswordReset === undefined) { |
| 414 | accountLockout.unlockOnPasswordReset = AccountLockoutOptions.unlockOnPasswordReset.default; |
| 415 | } else if (!isBoolean(accountLockout.unlockOnPasswordReset)) { |
| 416 | throw 'Parse Server option accountLockout.unlockOnPasswordReset must be a boolean.'; |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | static validatePasswordPolicy(passwordPolicy) { |
| 422 | if (passwordPolicy) { |