refactoring some code by removing unnecessary checks and moving tests block to root /

This commit is contained in:
2026-07-24 17:13:37 +03:00
parent 26b857ed84
commit 1d25b0edc3
9 changed files with 35 additions and 15 deletions
+1 -2
View File
@@ -34,7 +34,6 @@ class Jwt:
user_info=data.copy()
user_info.update({"exp": datetime.now(timezone.utc)+timedelta(minutes=env_settings.ACCESS_TOKEN_EXPIRE_MINUTES),
"token_type":"access"})
print(f"DEBUG: expires at {datetime.now(timezone.utc)+timedelta(minutes=env_settings.ACCESS_TOKEN_EXPIRE_MINUTES)}, minutes={env_settings.ACCESS_TOKEN_EXPIRE_MINUTES}")
return jwt.encode(user_info, env_settings.SECRET_KEY, env_settings.ALGORITHM)
@@ -57,7 +56,7 @@ class Jwt:
payload=jwt.decode(token, env_settings.SECRET_KEY, algorithms=[env_settings.ALGORITHM])
if (payload.get("sub")) is None:
raise self.error.credentials_error(detail="Sub block is missing")
raise self.error.credentials_error(detail="Jwt token is incorrect")
except JWTError as e:
raise self.error.credentials_error(detail="JWTerror") from e