Update app.py
Browse files
app.py
CHANGED
@@ -288,11 +288,11 @@ async def register_post(
|
|
288 |
try:
|
289 |
registered_user = register_user(user_data, db)
|
290 |
# Store user info in the session after successful registration
|
291 |
-
request.session["
|
292 |
# Create an access token
|
293 |
access_token = create_access_token(data={"sub": registered_user.email})
|
294 |
# Redirect to the protected route
|
295 |
-
response = RedirectResponse(url="/
|
296 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
297 |
return response
|
298 |
except HTTPException as e:
|
|
|
288 |
try:
|
289 |
registered_user = register_user(user_data, db)
|
290 |
# Store user info in the session after successful registration
|
291 |
+
request.session["access_token"] = {"username": registered_user.username, "email": registered_user.email}
|
292 |
# Create an access token
|
293 |
access_token = create_access_token(data={"sub": registered_user.email})
|
294 |
# Redirect to the protected route
|
295 |
+
response = RedirectResponse(url="/protected")
|
296 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
297 |
return response
|
298 |
except HTTPException as e:
|