Compare commits
No commits in common. "master" and "1.6.1" have entirely different histories.
@ -84,7 +84,8 @@ async def read_events(
|
|||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail="`skip` should be >= 0 and `limit` should be > 0 and greater than `skip`.",
|
detail="`skip` should be >= 0 and `limit` should be > 0 and greater than `skip`.",
|
||||||
)
|
)
|
||||||
skip = limit * skip
|
limit = limit + skip
|
||||||
|
|
||||||
# Initialize filters
|
# Initialize filters
|
||||||
filters = []
|
filters = []
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ async def search_events(
|
|||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail="`skip` should be >= 0 and `limit` should be > 0 and greater than `skip`.",
|
detail="`skip` should be >= 0 and `limit` should be > 0 and greater than `skip`.",
|
||||||
)
|
)
|
||||||
skip = limit * skip
|
limit = limit + skip
|
||||||
|
|
||||||
# Initialize filters
|
# Initialize filters
|
||||||
filters = [{"status": {"$eq": status}}]
|
filters = [{"status": {"$eq": status}}]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
from fastapi import Depends, FastAPI, HTTPException, status, APIRouter, Form
|
from fastapi import Depends, FastAPI, HTTPException, status, APIRouter
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||||
from ..dependencies import users_token, permissions_checker
|
from ..dependencies import users_token, permissions_checker
|
||||||
@ -13,11 +13,10 @@ ACCESS_TOKEN_EXPIRE_MINUTES = 30
|
|||||||
|
|
||||||
@router.post("/token", tags=["token"])
|
@router.post("/token", tags=["token"])
|
||||||
async def login_for_access_token(
|
async def login_for_access_token(
|
||||||
form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
|
form_data: Annotated[OAuth2PasswordRequestForm, Depends()]):
|
||||||
remember_me: bool = Form(False)):
|
|
||||||
user = users_token.authenticate_user(form_data.username, form_data.password)
|
user = users_token.authenticate_user(form_data.username, form_data.password)
|
||||||
expires_access_token_time = ACCESS_TOKEN_EXPIRE_MINUTES
|
expires_access_token_time = ACCESS_TOKEN_EXPIRE_MINUTES
|
||||||
if remember_me:
|
if form_data.remember_me.lower() in ["true", "1", "yes"]:
|
||||||
expires_access_token_time=120
|
expires_access_token_time=120
|
||||||
if not user:
|
if not user:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user