cleanup code

This commit is contained in:
maxDorninger
2025-03-27 20:45:30 +01:00
parent e00f0b5a54
commit 1a558361f4

View File

@@ -61,11 +61,11 @@ async def get_current_user(db: SessionDependency, token: str = Depends(oauth2_sc
def create_access_token(data: dict, expires_delta: timedelta | None = None):
to_encode = data.copy()
config = AuthConfig
auth_config = AuthConfig
if expires_delta:
expire = datetime.now(timezone.utc) + expires_delta
else:
expire = datetime.now(timezone.utc) + timedelta(minutes=config.jwt_access_token_lifetime)
expire = datetime.now(timezone.utc) + timedelta(minutes=auth_config.jwt_access_token_lifetime)
to_encode.update({"exp": expire})
encoded_jwt = jwt.encode(to_encode, config.jwt_signing_key, algorithm=config.jwt_signing_algorithm)
encoded_jwt = jwt.encode(to_encode, auth_config.jwt_signing_key, algorithm=auth_config.jwt_signing_algorithm)
return encoded_jwt