Fix: login failed as python-jose was removed.
This commit is contained in:
parent
82747c4b89
commit
0b092b5467
@ -3,10 +3,10 @@ import uuid
|
|||||||
from datetime import UTC, datetime, timedelta
|
from datetime import UTC, datetime, timedelta
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
import jwt
|
||||||
|
|
||||||
from fastapi import Depends, HTTPException, Security, status
|
from fastapi import Depends, HTTPException, Security, status
|
||||||
from fastapi.security import OAuth2PasswordBearer, SecurityScopes
|
from fastapi.security import OAuth2PasswordBearer, SecurityScopes
|
||||||
from jose import jwt
|
|
||||||
from jose.exceptions import ExpiredSignatureError
|
|
||||||
from jwt import PyJWTError
|
from jwt import PyJWTError
|
||||||
from pydantic import BaseModel, ValidationError
|
from pydantic import BaseModel, ValidationError
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
@ -82,7 +82,7 @@ async def get_current_user(
|
|||||||
raise credentials_exception
|
raise credentials_exception
|
||||||
token_scopes = payload.get("scopes", [])
|
token_scopes = payload.get("scopes", [])
|
||||||
token_data = TokenData(scopes=token_scopes, username=username)
|
token_data = TokenData(scopes=token_scopes, username=username)
|
||||||
except (PyJWTError, ValidationError, ExpiredSignatureError):
|
except (PyJWTError, ValidationError):
|
||||||
raise credentials_exception
|
raise credentials_exception
|
||||||
user = get_user(
|
user = get_user(
|
||||||
username=token_data.username,
|
username=token_data.username,
|
||||||
|
@ -117,5 +117,5 @@ app.include_router(split.router, prefix="/api", tags=["voucher"])
|
|||||||
app.include_router(change.router, prefix="/api/voucher", tags=["voucher"])
|
app.include_router(change.router, prefix="/api/voucher", tags=["voucher"])
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init() -> None:
|
||||||
uvicorn.run(app, host=settings.HOST, port=settings.PORT)
|
uvicorn.run(app, host=settings.HOST, port=settings.PORT)
|
||||||
|
@ -45,7 +45,7 @@ def product_sale_report_view(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def product_sale_report(s: date, f: date, id_: uuid.UUID, db: Session):
|
def product_sale_report(s: date, f: date, id_: uuid.UUID | None, db: Session):
|
||||||
start_date = datetime.combine(s, time()) + timedelta(
|
start_date = datetime.combine(s, time()) + timedelta(
|
||||||
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
|
||||||
)
|
)
|
||||||
@ -128,7 +128,7 @@ def print_report(
|
|||||||
"startDate": start_date.strftime("%d-%b-%Y"),
|
"startDate": start_date.strftime("%d-%b-%Y"),
|
||||||
"finishDate": finish_date.strftime("%d-%b-%Y"),
|
"finishDate": finish_date.strftime("%d-%b-%Y"),
|
||||||
"sectionId": str(section) if section is not None else None,
|
"sectionId": str(section) if section is not None else None,
|
||||||
"amounts": product_sale_report(start_date, finish_date, db),
|
"amounts": product_sale_report(start_date, finish_date, section, db),
|
||||||
}
|
}
|
||||||
print_product_sale_report(report, device_id, db)
|
print_product_sale_report(report, device_id, db)
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user