修复 用户配置不生效

This commit is contained in:
2025-11-18 15:30:23 +08:00
parent f8ed0ef3c0
commit 8e8e39611a
4 changed files with 23 additions and 9 deletions

View File

@@ -94,6 +94,11 @@ class RegisterRequest(BaseModel):
class UserSettingRequest(BaseModel): class UserSettingRequest(BaseModel):
language: Optional[str] = None language: Optional[str] = None
nickname: Optional[str] = None
avatar: Optional[str] = None
timezone: Optional[str] = None
password: Optional[str] = None
new_password: Optional[str] = None
class TenantInfoRequest(BaseModel): class TenantInfoRequest(BaseModel):
@@ -304,18 +309,23 @@ async def setting_user(request: UserSettingRequest, current_user = Depends(get_c
更新用户设置 更新用户设置
""" """
update_dict = {} update_dict = {}
request_data = request.dict() request_data = request.dict(exclude_unset=True)
if request_data.get("password"): password = request_data.get("password")
new_password = request_data.get("new_password") new_password = request_data.get("new_password")
if not check_password_hash(current_user.password, decrypt(request_data["password"])): if password is not None or new_password is not None:
if not password or not new_password:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="Both password and new_password are required!"
)
if not check_password_hash(current_user.password, decrypt(password)):
raise HTTPException( raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
detail="Password error!" detail="Password error!"
) )
if new_password: update_dict["password"] = generate_password_hash(decrypt(new_password))
update_dict["password"] = generate_password_hash(decrypt(new_password))
for k in request_data.keys(): for k in request_data.keys():
if k in [ if k in [

View File

@@ -3,7 +3,7 @@
# - `elasticsearch` (default) # - `elasticsearch` (default)
# - `infinity` (https://github.com/infiniflow/infinity) # - `infinity` (https://github.com/infiniflow/infinity)
# - `opensearch` (https://github.com/opensearch-project/OpenSearch) # - `opensearch` (https://github.com/opensearch-project/OpenSearch)
DOC_ENGINE=opensearch DOC_ENGINE=elasticsearch
# ------------------------------ # ------------------------------
# docker env var for specifying vector db type at startup # docker env var for specifying vector db type at startup

View File

@@ -109,6 +109,7 @@ services:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
networks: networks:
- ragflow - ragflow
mem_limit: ${MEM_LIMIT}
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}"]
interval: 10s interval: 10s
@@ -139,6 +140,7 @@ services:
- SANDBOX_ENABLE_SECCOMP=${SANDBOX_ENABLE_SECCOMP:-false} - SANDBOX_ENABLE_SECCOMP=${SANDBOX_ENABLE_SECCOMP:-false}
- SANDBOX_MAX_MEMORY=${SANDBOX_MAX_MEMORY:-256m} - SANDBOX_MAX_MEMORY=${SANDBOX_MAX_MEMORY:-256m}
- SANDBOX_TIMEOUT=${SANDBOX_TIMEOUT:-10s} - SANDBOX_TIMEOUT=${SANDBOX_TIMEOUT:-10s}
mem_limit: ${MEM_LIMIT}
healthcheck: healthcheck:
test: ["CMD", "curl", "http://localhost:9385/healthz"] test: ["CMD", "curl", "http://localhost:9385/healthz"]
interval: 10s interval: 10s
@@ -163,6 +165,7 @@ services:
networks: networks:
- ragflow - ragflow
restart: on-failure restart: on-failure
mem_limit: ${MEM_LIMIT}
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s interval: 30s
@@ -182,6 +185,7 @@ services:
networks: networks:
- ragflow - ragflow
restart: on-failure restart: on-failure
mem_limit: ${MEM_LIMIT}
healthcheck: healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"] test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 5s interval: 5s

View File

@@ -30,8 +30,8 @@ services:
ports: ports:
- ${SVR_HTTP_PORT}:9380 - ${SVR_HTTP_PORT}:9380
- ${ADMIN_SVR_HTTP_PORT}:9381 - ${ADMIN_SVR_HTTP_PORT}:9381
- 80:80 - 8000:80
- 443:443 - 8443:443
- 5678:5678 - 5678:5678
- 5679:5679 - 5679:5679
- 9382:9382 # entry for MCP (host_port:docker_port). The docker_port must match the value you set for `mcp-port` above. - 9382:9382 # entry for MCP (host_port:docker_port). The docker_port must match the value you set for `mcp-port` above.