Renamed hooks on frontend and started working on shop registration

This commit is contained in:
Thastertyn committed 2025-03-13 15:41:44 +01:00
1 parent 3b42ea6914
commit 9c2b88b103
35 files changed
+180 -37

No files matched your search

+16 -8
View File
@@ -1,24 +1,32 @@
from datetime import timedelta
from typing import Annotated
from fastapi import APIRouter, Depends, HTTPException
from fastapi.security import OAuth2PasswordRequestForm
from fastapi import APIRouter, HTTPException
from app.api.dependencies import SessionDep
from app.api.dependencies import LoginDep, SessionDep
from app.core import security
from app.core.config import settings
from app.crud import user_crud
from app.schemas.user_schemas import Token
router = APIRouter(tags=["Login"])
router = APIRouter(tags=["Dashboard", "Login"])
@router.post("/login/access-token")
@router.post("/login/access-token", include_in_schema=settings.is_local_environment, response_model=Token)
def login_access_token(
session: SessionDep, form_data: Annotated[OAuth2PasswordRequestForm, Depends()]
session: SessionDep, form_data: LoginDep
) -> Token:
"""
OAuth2 compatible token login, get an access token for future requests
OAuth2 compatible token login for the dashboard.
This endpoint generates an access token required for authenticating future
requests to the dashboard section of the application. The token is valid for
a predefined expiration period.
- **username**: User's email
- **password**: User's password
**Note:** This login is restricted to dashboard access only and cannot be
used for tenant accounts access to shops
"""
user = None
user = user_crud.authenticate(