Update app.py
Browse files
app.py
CHANGED
@@ -218,7 +218,7 @@ async def registration_successful(request: Request, db: Session = Depends(get_db
|
|
218 |
)
|
219 |
|
220 |
# Redirect the user to the protected route
|
221 |
-
response = RedirectResponse(url="/
|
222 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
223 |
return response
|
224 |
|
@@ -255,7 +255,7 @@ async def verify_email(token: str, db: Session = Depends(get_db)):
|
|
255 |
access_token = create_access_token(data={"sub": user.email}, expires_delta=timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES))
|
256 |
|
257 |
# Redirect to the protected route and set the token in a secure, HTTP-only cookie
|
258 |
-
response = RedirectResponse(url="/
|
259 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True, secure=True, samesite='Lax')
|
260 |
return response
|
261 |
|
@@ -292,7 +292,7 @@ async def register_post(
|
|
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:
|
|
|
218 |
)
|
219 |
|
220 |
# Redirect the user to the protected route
|
221 |
+
response = RedirectResponse(url="/login")
|
222 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
223 |
return response
|
224 |
|
|
|
255 |
access_token = create_access_token(data={"sub": user.email}, expires_delta=timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES))
|
256 |
|
257 |
# Redirect to the protected route and set the token in a secure, HTTP-only cookie
|
258 |
+
response = RedirectResponse(url="/protected")
|
259 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True, secure=True, samesite='Lax')
|
260 |
return response
|
261 |
|
|
|
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="/login")
|
296 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
297 |
return response
|
298 |
except HTTPException as e:
|