Skip to content

Commit 546dc8b

Browse files
dmontagutiangolo
authored andcommitted
🔒 Update login.py to receive password as body (#33)
Change `new_password` from a query parameter to a body parameter for security. (Why this is problematic is discussed in the top answer to https://stackoverflow.com/questions/2629222/are-querystring-parameters-secure-in-https-http-ssl)
1 parent eae33cd commit 546dc8b

File tree

1 file changed

+2
-2
lines changed
  • {{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints

1 file changed

+2
-2
lines changed

{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/login.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import timedelta
22

3-
from fastapi import APIRouter, Depends, HTTPException
3+
from fastapi import APIRouter, Body, Depends, HTTPException
44
from fastapi.security import OAuth2PasswordRequestForm
55
from sqlalchemy.orm import Session
66

@@ -74,7 +74,7 @@ def recover_password(email: str, db: Session = Depends(get_db)):
7474

7575

7676
@router.post("/reset-password/", tags=["login"], response_model=Msg)
77-
def reset_password(token: str, new_password: str, db: Session = Depends(get_db)):
77+
def reset_password(token: str, new_password: str = Body(...), db: Session = Depends(get_db)):
7878
"""
7979
Reset password
8080
"""

0 commit comments

Comments
 (0)