From 9803156d472f82f0ae3f71afc695b6c86e17a86a Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Tue, 26 Nov 2024 15:16:03 +0100 Subject: [PATCH] :bug: Fixed output of register (user_id missing) --- app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index dbbd53d..ab73c99 100644 --- a/app/main.py +++ b/app/main.py @@ -94,12 +94,12 @@ async def register(user: UserRegisterDTO): ) hashed_password = get_password_hash(user.password) - users_collection.insert_one({"username": user.username, "password": hashed_password}) + user_id = users_collection.insert_one({"username": user.username, "password": hashed_password}) access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES) access_token = create_access_token(data={"sub": user.username}, expires_delta=access_token_expires) - return {"access_token": access_token, "token_type": "bearer", "user_id": str(user["_id"])} + return {"access_token": access_token, "token_type": "bearer", "user_id": str(user_id)} @app.post( path="/login",