| # Maximum number of submitted thread count in a ThreadPool for parallel node execution | # Maximum number of submitted thread count in a ThreadPool for parallel node execution | ||||
| MAX_SUBMIT_COUNT=100 | MAX_SUBMIT_COUNT=100 | ||||
| # Lockout duration in seconds | |||||
| LOGIN_LOCKOUT_DURATION=86400 |
| default=60, | default=60, | ||||
| ) | ) | ||||
| LOGIN_LOCKOUT_DURATION: PositiveInt = Field( | |||||
| description="Time (in seconds) a user must wait before retrying login after exceeding the rate limit.", | |||||
| default=86400, | |||||
| ) | |||||
| class ModerationConfig(BaseSettings): | class ModerationConfig(BaseSettings): | ||||
| """ | """ |
| if count is None: | if count is None: | ||||
| count = 0 | count = 0 | ||||
| count = int(count) + 1 | count = int(count) + 1 | ||||
| redis_client.setex(key, 60 * 60 * 24, count) | |||||
| redis_client.setex(key, dify_config.LOGIN_LOCKOUT_DURATION, count) | |||||
| @staticmethod | @staticmethod | ||||
| def is_login_error_rate_limit(email: str) -> bool: | def is_login_error_rate_limit(email: str) -> bool: |