用户问题返回403,以便UI跳转登录
This commit is contained in:
parent
9986343420
commit
4a91a43c30
@ -13,7 +13,7 @@ def get_current_user(
|
||||
) -> User:
|
||||
user = User.get(db, rid=token_data.sub)
|
||||
if not user:
|
||||
raise HTTPException(status_code=404, detail="用户不存在")
|
||||
raise HTTPException(status_code=403, detail="用户不存在")
|
||||
return user
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ def get_current_active_user(
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> User:
|
||||
if not current_user.is_active:
|
||||
raise HTTPException(status_code=400, detail="用户未激活")
|
||||
raise HTTPException(status_code=403, detail="用户未激活")
|
||||
return current_user
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user