Merge branch 'main' of https://gitee.com/wg123/video-gen
This commit is contained in:
@@ -6,6 +6,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from app.models.base import async_session
|
||||
from app.models.user import User
|
||||
from app.services.auth import decode_access_token, user_must_set_password
|
||||
from app.services.credit.query_service import attach_credit_snapshot, get_available_credits
|
||||
|
||||
security = HTTPBearer(auto_error=False)
|
||||
|
||||
@@ -64,6 +65,7 @@ async def get_current_user_allow_password_pending(
|
||||
detail="账号已在其他设备登录,请重新登录",
|
||||
)
|
||||
|
||||
attach_credit_snapshot(user, await get_available_credits(db, user.id))
|
||||
return user
|
||||
|
||||
|
||||
@@ -103,6 +105,7 @@ async def get_optional_current_user(
|
||||
if user_must_set_password(user):
|
||||
return None
|
||||
|
||||
attach_credit_snapshot(user, await get_available_credits(db, user.id))
|
||||
return user
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user