fix(auth): correct local cookie security configuration

This commit is contained in:
Schubert Ferenc 2026-07-11 15:50:15 +02:00
parent b584e60273
commit 155fdbb16a
67 changed files with 1003 additions and 62 deletions

View file

@ -11,14 +11,19 @@ from app.models.user import User
from app.core.security import hash_password, verify_password
from app.schemas.auth import ChangePasswordRequest, LoginRequest, TokenResponse, UserRead
from app.services.auth_service import AuthService
from app.core.config import settings
router = APIRouter(prefix="/auth", tags=["auth"])
@router.post("/login", response_model=TokenResponse)
def login(payload: LoginRequest, session: Session = Depends(get_session)) -> TokenResponse:
token = AuthService(session).login(payload.email, payload.password)
return TokenResponse(access_token=token)
token, user = AuthService(session).login(payload.email, payload.password)
return TokenResponse(
access_token=token,
expires_in=settings.access_token_minutes * 60,
user=user,
)
@router.get("/me", response_model=UserRead)