初步迁移数据库

This commit is contained in:
2025-09-28 11:49:26 +08:00
parent 6c512805e8
commit db77d6033b
20 changed files with 249 additions and 153 deletions

View File

@@ -7,7 +7,7 @@ from fastapi import APIRouter
import jwt, JWT
from model.token import Token
from model import database
from model import Setting, database
from tool import verify_password
Router = APIRouter(tags=["令牌 session"])
@@ -26,8 +26,8 @@ def create_access_token(data: dict, expires_delta: timedelta | None = None):
# 验证账号密码
async def authenticate_user(username: str, password: str):
# 验证账号和密码
account = await database.Database().get_setting('account')
stored_password = await database.Database().get_setting('password')
account = await Setting.get('setting', 'account')
stored_password = await Setting.get('setting', 'password')
if account != username or not verify_password(stored_password, password):
return False