瀏覽代碼

make login lockout duration configurable (#11699)

tags/0.14.1
Kazuhisa Wada 10 月之前
父節點
當前提交
e20161b3de
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 8 行新增1 行删除
  1. 2
    0
      api/.env.example
  2. 5
    0
      api/configs/feature/__init__.py
  3. 1
    1
      api/services/account_service.py

+ 2
- 0
api/.env.example 查看文件

@@ -435,3 +435,5 @@ CREATE_TIDB_SERVICE_JOB_ENABLED=false

# Maximum number of submitted thread count in a ThreadPool for parallel node execution
MAX_SUBMIT_COUNT=100
# Lockout duration in seconds
LOGIN_LOCKOUT_DURATION=86400

+ 5
- 0
api/configs/feature/__init__.py 查看文件

@@ -485,6 +485,11 @@ class AuthConfig(BaseSettings):
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):
"""

+ 1
- 1
api/services/account_service.py 查看文件

@@ -420,7 +420,7 @@ class AccountService:
if count is None:
count = 0
count = int(count) + 1
redis_client.setex(key, 60 * 60 * 24, count)
redis_client.setex(key, dify_config.LOGIN_LOCKOUT_DURATION, count)

@staticmethod
def is_login_error_rate_limit(email: str) -> bool:

Loading…
取消
儲存