modify: 依赖更新

This commit is contained in:
2026-04-26 20:44:18 +08:00
parent 450be84020
commit d13ad1f907
7 changed files with 623 additions and 576 deletions
+1 -1
View File
@@ -1 +1 @@
3.11
3.12
+3 -3
View File
@@ -66,12 +66,12 @@ docker build -t chongming:latest .
导出镜像
```shell
docker save -o chongming_v1.0.tar chongming:v1.0
docker save -o chongming_latest.tar chongming:latest
```
导入镜像
```shell
docker load -i chongming_v1.0.tar
docker load -i chongming_latest.tar
```
运行镜像
@@ -80,5 +80,5 @@ mkdir -p /data/chongming
docker run -d -p 8000:8000 \
-v /data/chongming/database.db:/app/database.db \
-v /data/chongming/uploads:/app/uploads \
--name chongming chongming:v1.0
--name chongming chongming:latest
```
+4 -5
View File
@@ -9,17 +9,16 @@ description = "基于 modules-bank 的 fastapi 打包脚手架"
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
"aiofiles>=24.1.0",
"aiofiles",
"aiosqlite",
"apscheduler",
"bcrypt==4.0.1",
"bcrypt",
"diskcache",
"fastapi[uvicorn]",
"gunicorn>=23.0.0",
"gunicorn",
"module-bank",
"passlib[bcrypt]",
"pyjwt",
"python-multipart>=0.0.20",
"python-multipart",
"sqlite-vfs",
"sqlmodel[aiosqlite]",
"tomli",
+5 -3
View File
@@ -1,12 +1,14 @@
aiofiles
aiosqlite
apscheduler
bcrypt==4.0.1
bcrypt
diskcache
fastapi[uvicorn]
gunicorn
module-bank
passlib[bcrypt]
pyjwt
python-multipart
sqlite-vfs
sqlitedict
sqlmodel[aiosqlite]
tomli
typing-extensions
+11 -12
View File
@@ -1,14 +1,13 @@
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def verify_password(plain_password: str, hashed_password: str) -> bool:
"""验证密码"""
return pwd_context.verify(plain_password, hashed_password)
# src/chongming/app/core/security.py
import bcrypt
def get_password_hash(password: str) -> str:
"""密码哈希"""
return pwd_context.hash(password)
salt = bcrypt.gensalt()
hashed = bcrypt.hashpw(password.encode('utf-8'), salt)
return hashed.decode('utf-8')
def verify_password(plain_password: str, hashed_password: str) -> bool:
return bcrypt.checkpw(
plain_password.encode('utf-8'),
hashed_password.encode('utf-8')
)
+5 -3
View File
@@ -4,7 +4,7 @@
from typing import Optional
from fastapi import Request
from passlib.context import CryptContext
import bcrypt
from sqlalchemy.ext.asyncio import AsyncSession
from ..model.user import User
@@ -20,7 +20,6 @@ class AuthService:
def __init__(self):
self.jwt_cache = get_jwt_cache()
self.settings = get_config()
self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
async def authenticate_user(
self, email: str, password: str, session: AsyncSession
@@ -29,7 +28,10 @@ class AuthService:
user = await UserService.get_user_by_email(email, session)
if not user:
return None
if not self.pwd_context.verify(password, user.hashed_password):
if not bcrypt.checkpw(
password.encode('utf-8'),
user.hashed_password.encode('utf-8')
):
return None
return user
Generated
+594 -549
View File
File diff suppressed because it is too large Load Diff