Skip to content

Commit c0123bb

Browse files
authored
Merge pull request #3 from tiangolo/master
Merge in tiangolo branch
2 parents 900a278 + 44d8a43 commit c0123bb

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ After using this generator, your new project (the directory created) will contai
148148

149149
### Next release
150150

151+
### 0.4.0
152+
153+
* Fix security on resetting a password. Receive token as body, not query. PR [#34](https://github.com/tiangolo/full-stack-fastapi-postgresql/pull/34).
154+
155+
* Fix security on resetting a password. Receive it as body, not query. PR [#33](https://github.com/tiangolo/full-stack-fastapi-postgresql/pull/33) by [@dmontagu](https://github.com/dmontagu).
156+
157+
* Fix SQLAlchemy class lookup on initialization. PR [#29](https://github.com/tiangolo/full-stack-fastapi-postgresql/pull/29) by [@ebreton](https://github.com/ebreton).
158+
159+
* Fix SQLAlchemy operation errors on database restart. PR [#32](https://github.com/tiangolo/full-stack-fastapi-postgresql/pull/32) by [@ebreton](https://github.com/ebreton).
160+
151161
* Fix locations of scripts in generated README. PR [#19](https://github.com/tiangolo/full-stack-fastapi-postgresql/pull/19) by [@ebreton](https://github.com/ebreton).
152162

153163
* Forward arguments from script to `pytest` inside container. PR [#17](https://github.com/tiangolo/full-stack-fastapi-postgresql/pull/17) by [@ebreton](https://github.com/ebreton).

{{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 = Body(...), new_password: str = Body(...), db: Session = Depends(get_db)):
7878
"""
7979
Reset password
8080
"""

{{cookiecutter.project_slug}}/backend/app/app/db/init_db.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
from app.core import config
33
from app.models.user import UserCreate
44

5+
# make sure all SQL Alchemy models are imported before initializing DB
6+
# otherwise, SQL Alchemy might fail to initialize properly relationships
7+
# for more details: https://github.com/tiangolo/full-stack-fastapi-postgresql/issues/28
8+
from app.db import base
9+
510

611
def init_db(db_session):
712
# Tables should be created with Alembic migrations

{{cookiecutter.project_slug}}/backend/app/app/db/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from app.core import config
55

6-
engine = create_engine(config.SQLALCHEMY_DATABASE_URI)
6+
engine = create_engine(config.SQLALCHEMY_DATABASE_URI, pool_pre_ping=True)
77
db_session = scoped_session(
88
sessionmaker(autocommit=False, autoflush=False, bind=engine)
99
)

0 commit comments

Comments
 (0)