From 9dec108000e7e49f3c03ff2c480aedf463092a40 Mon Sep 17 00:00:00 2001 From: Pedro Marques Date: Fri, 30 Aug 2024 23:10:07 -0300 Subject: [PATCH] Creating Docs --- app/routers/auth.py | 6 +++--- app/types/pydantic_models.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/routers/auth.py b/app/routers/auth.py index f6d123f..9053c0f 100644 --- a/app/routers/auth.py +++ b/app/routers/auth.py @@ -7,7 +7,7 @@ from fastapi.responses import StreamingResponse from app.models import User -from app.types.pydantic_models import Token +from app.types.pydantic_models import Token, Enable2FA from app.utils import authenticate_user, generate_user_token from app.security import TwoFactorAuth from app.dependencies import ( @@ -96,7 +96,7 @@ async def login_with_2fa( @router.post("/2fa/enable/") async def enable_2fa( current_user: Annotated[User, Depends(get_current_frontend_user)], -): +) -> Enable2FA: secret_key = await TwoFactorAuth.get_or_create_secret_key(current_user.id) two_factor_auth = TwoFactorAuth(current_user.id, secret_key) @@ -108,7 +108,7 @@ async def enable_2fa( @router.get("/2fa/generate-qrcode/") async def generate_qrcode( form_data: Annotated[OAuth2PasswordRequestForm, Depends()], -): +) -> bytes: current_user = await authenticate_user(form_data.username, form_data.password) if not current_user: raise HTTPException( diff --git a/app/types/pydantic_models.py b/app/types/pydantic_models.py index f2f6f5d..9003be1 100644 --- a/app/types/pydantic_models.py +++ b/app/types/pydantic_models.py @@ -323,3 +323,7 @@ class TeamModel(BaseModel): outros_profissionais: List[str] ultima_atualizacao_profissionais: date ultima_atualizacao_infos_equipe: date + + +class Enable2FA(BaseModel): + secret_key: str \ No newline at end of file