Refactor import order and remove unnecessary samesite attribute in set_cookie() calls (#1370)

This pull request refactors the import order and removes the unnecessary samesite attribute in the set_cookie() calls. This change improves the code readability and removes redundant code.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-01-26 14:10:32 -03:00 • committed by GitHub
commit eece7b60c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "langflow" name = "langflow"
version = "0.6.5a10" version = "0.6.5a11"
description = "A Python package with a built-in web application" description = "A Python package with a built-in web application"
authors = ["Logspace <contact@logspace.ai>"] authors = ["Logspace <contact@logspace.ai>"]
maintainers = [ maintainers = [

View file

@ -1,4 +1,4 @@
from fastapi import Request, Response, APIRouter, Depends, HTTPException, status from fastapi import APIRouter, Depends, HTTPException, Request, Response, status
from fastapi.security import OAuth2PasswordRequestForm from fastapi.security import OAuth2PasswordRequestForm
from sqlmodel import Session from sqlmodel import Session
@ -33,8 +33,8 @@ async def login_to_get_access_token(
if user: if user:
tokens = create_user_tokens(user_id=user.id, db=db, update_last_login=True) tokens = create_user_tokens(user_id=user.id, db=db, update_last_login=True)
response.set_cookie("refresh_token_lf", tokens["refresh_token"], httponly=True, secure=True, samesite="strict") response.set_cookie("refresh_token_lf", tokens["refresh_token"], httponly=True, secure=True)
response.set_cookie("access_token_lf", tokens["access_token"], httponly=False, secure=True, samesite="strict") response.set_cookie("access_token_lf", tokens["access_token"], httponly=False, secure=True)
return tokens return tokens
else: else:
raise HTTPException( raise HTTPException(