mirror of
https://github.com/Radiquum/AniX.git
synced 2025-05-02 10:59:40 +05:00
Back and Front: User Login
This commit is contained in:
parent
a03deddbc0
commit
32a4da1a31
8 changed files with 141 additions and 36 deletions
|
@ -1,20 +1,21 @@
|
|||
from typing import Annotated
|
||||
|
||||
import requests
|
||||
from fastapi import APIRouter
|
||||
from fastapi import Form
|
||||
from fastapi import Request
|
||||
from modules.proxy import ENDPOINTS
|
||||
from modules.proxy import USER_AGENT
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class User(BaseModel):
|
||||
email: str
|
||||
password: str
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post("", summary="logging in")
|
||||
async def userSignIn(
|
||||
request: Request,
|
||||
email: Annotated[str, Form()],
|
||||
password: Annotated[str, Form()],
|
||||
user: User,
|
||||
short: bool = False,
|
||||
):
|
||||
headers = {
|
||||
|
@ -26,7 +27,7 @@ async def userSignIn(
|
|||
# noqa: E501
|
||||
f"{ENDPOINTS['auth']}",
|
||||
headers=headers,
|
||||
data={"login": email, "password": password},
|
||||
data={"login": user.email, "password": user.password},
|
||||
)
|
||||
if r.status_code != 200:
|
||||
return {"error": r.text}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue