Skip to content

Commit

Permalink
adding logout route + returning full name in connection route
Browse files Browse the repository at this point in the history
  • Loading branch information
RobsOnWaves committed Dec 28, 2023
1 parent c7b1170 commit 11f9552
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Code/public_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Roles(str, Enum):
class Token(BaseModel):
access_token: str
token_type: str
name: str


class TokenData(BaseModel):
Expand Down Expand Up @@ -208,7 +209,7 @@ async def login_for_access_token(form_data: OAuth2PasswordRequestForm = Depends(
access_token = create_access_token(
data={"sub": user.username}, expires_delta=access_token_expires
)
return {"access_token": access_token, "token_type": "bearer"}
return {"access_token": access_token, "name": user.full_name, "token_type": "bearer"}


@app.get("/users/me/", response_model=User, description="Returns information about the current logged in user")
Expand Down Expand Up @@ -348,5 +349,10 @@ async def ged_collection_to_json_file(file: UploadFile,
return {'response': messages.nok_string}


@app.post("/logout")
async def logout():
return {"message": "Disconnected, please log in again"}


if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)

0 comments on commit 11f9552

Please sign in to comment.