Add Yaohuo verification-based self-service signup
This commit is contained in:
@@ -64,6 +64,10 @@ class Settings:
|
||||
token_endpoint: str
|
||||
scope: str
|
||||
database_url: str
|
||||
yaohuo_cookie: str
|
||||
yaohuo_message_url: str
|
||||
yaohuo_verification_enabled: bool
|
||||
yaohuo_verification_code_ttl_seconds: int
|
||||
default_page_size: int = 25
|
||||
max_page_size: int = 100
|
||||
validation_errors: tuple[str, ...] = field(default_factory=tuple)
|
||||
@@ -92,6 +96,7 @@ class Settings:
|
||||
"forceChangePassword": self.force_change_password,
|
||||
"pageSize": self.default_page_size,
|
||||
"maxPageSize": self.max_page_size,
|
||||
"yaohuoVerificationEnabled": self.yaohuo_verification_enabled,
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +154,11 @@ def load_settings() -> Settings:
|
||||
token_endpoint=token_endpoint,
|
||||
scope=scope,
|
||||
database_url=database_url,
|
||||
yaohuo_cookie=os.getenv("YAOHUO_COOKIE", "").strip(),
|
||||
yaohuo_message_url=os.getenv("YAOHUO_MESSAGE_URL", "https://www.yaohuo.me/bbs/messagelist_add.aspx").strip()
|
||||
or "https://www.yaohuo.me/bbs/messagelist_add.aspx",
|
||||
yaohuo_verification_enabled=_env_bool("YAOHUO_VERIFICATION_ENABLED", False),
|
||||
yaohuo_verification_code_ttl_seconds=min(max(_env_int("YAOHUO_VERIFICATION_CODE_TTL_SECONDS", 600), 60), 3600),
|
||||
default_page_size=min(max(_env_int("DEFAULT_PAGE_SIZE", 25), 1), 100),
|
||||
max_page_size=min(max(_env_int("MAX_PAGE_SIZE", 100), 10), 500),
|
||||
validation_errors=tuple(validation_errors),
|
||||
|
||||
Reference in New Issue
Block a user