Allow login
This commit is contained in:
parent
cf6ceedfd5
commit
8aa51e548b
1 changed files with 10 additions and 0 deletions
|
@ -16,6 +16,11 @@ class Register(BaseModel):
|
|||
password_verify: str
|
||||
|
||||
|
||||
class Login(BaseModel):
|
||||
username_or_email: str
|
||||
password: str
|
||||
|
||||
|
||||
def create_router() -> APIRouter:
|
||||
router = APIRouter(prefix="/user", tags=["user"])
|
||||
|
||||
|
@ -35,4 +40,9 @@ def create_router() -> APIRouter:
|
|||
request = requests.post(urljoin(LEMMY_URL, "api/v3/user/register"), json=lemmy_register)
|
||||
return Response(content=request.content, status_code=request.status_code, media_type="text/json")
|
||||
|
||||
@router.post("/login")
|
||||
def register_user(login: Login) -> Response:
|
||||
request = requests.post(urljoin(LEMMY_URL, "api/v3/user/login"), json=login.dict())
|
||||
return Response(content=request.content, status_code=request.status_code, media_type="text/json")
|
||||
|
||||
return router
|
||||
|
|
Loading…
Reference in a new issue