added functional groups api + started pictures
This commit is contained in:
@@ -8,6 +8,7 @@ from psycopg2._psycopg import connection
|
||||
from api.models import Token
|
||||
from api.utils import authenticate_user, create_access_token
|
||||
from db.internal import get_db_connection
|
||||
from db.users import check_user_disabled
|
||||
from settings import startup_settings
|
||||
|
||||
auth_router = APIRouter(prefix="/api", tags=["auth"])
|
||||
@@ -26,6 +27,14 @@ async def login(
|
||||
headers={"WWW-Authenticate": "Bearer"},
|
||||
)
|
||||
|
||||
user_disabled = check_user_disabled(conn, form_data.username)
|
||||
if user_disabled:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="User acoount is disabled",
|
||||
headers={"WWW-Authenticate": "Bearer"},
|
||||
)
|
||||
|
||||
access_token_expire_time = timedelta(minutes=startup_settings.access_token_expiration_time)
|
||||
access_token = create_access_token(
|
||||
data={"sub": form_data.username}, expires_delta=access_token_expire_time
|
||||
|
||||
Reference in New Issue
Block a user