Skip to content

Commit 5b015aa

Browse files
Merge branch 'fastapi:master' into refactor-status-code
2 parents f8e23eb + 0a5f102 commit 5b015aa

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

.github/workflows/generate-client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
python-version: "3.10"
2929
- name: Install uv
30-
uses: astral-sh/setup-uv@v2
30+
uses: astral-sh/setup-uv@v3
3131
with:
3232
version: "0.4.15"
3333
enable-cache: true

.github/workflows/lint-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v2
23+
uses: astral-sh/setup-uv@v3
2424
with:
2525
version: "0.4.15"
2626
enable-cache: true

.github/workflows/test-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v2
23+
uses: astral-sh/setup-uv@v3
2424
with:
2525
version: "0.4.15"
2626
enable-cache: true

backend/app/utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
from jinja2 import Template
1010
from jwt.exceptions import InvalidTokenError
1111

12+
from app.core import security
1213
from app.core.config import settings
1314

15+
logging.basicConfig(level=logging.INFO)
16+
logger = logging.getLogger(__name__)
17+
1418

1519
@dataclass
1620
class EmailData:
@@ -48,7 +52,7 @@ def send_email(
4852
if settings.SMTP_PASSWORD:
4953
smtp_options["password"] = settings.SMTP_PASSWORD
5054
response = message.send(to=email_to, smtp=smtp_options)
51-
logging.info(f"send email result: {response}")
55+
logger.info(f"send email result: {response}")
5256

5357

5458
def generate_test_email(email_to: str) -> EmailData:
@@ -104,14 +108,16 @@ def generate_password_reset_token(email: str) -> str:
104108
encoded_jwt = jwt.encode(
105109
{"exp": exp, "nbf": now, "sub": email},
106110
settings.SECRET_KEY,
107-
algorithm="HS256",
111+
algorithm=security.ALGORITHM,
108112
)
109113
return encoded_jwt
110114

111115

112116
def verify_password_reset_token(token: str) -> str | None:
113117
try:
114-
decoded_token = jwt.decode(token, settings.SECRET_KEY, algorithms=["HS256"])
118+
decoded_token = jwt.decode(
119+
token, settings.SECRET_KEY, algorithms=[security.ALGORITHM]
120+
)
115121
return str(decoded_token["sub"])
116122
except InvalidTokenError:
117123
return None

release-notes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
### Refactors
66

7+
* ♻️ Refactored code to use encryption algorithm name from settings for consistency. PR [#1160](https://github.com/fastapi/full-stack-fastapi-template/pull/1160) by [@sameeramin](https://github.com/sameeramin).
8+
* 🔊 Enable logging for email utils by default. PR [#1374](https://github.com/fastapi/full-stack-fastapi-template/pull/1374) by [@ihmily](https://github.com/ihmily).
79
* 🔧 Add `ENV PYTHONUNBUFFERED=1` to log output directly to Docker. PR [#1378](https://github.com/fastapi/full-stack-fastapi-template/pull/1378) by [@tiangolo](https://github.com/tiangolo).
810
* 💡 Remove unnecessary comment. PR [#1260](https://github.com/fastapi/full-stack-fastapi-template/pull/1260) by [@sebhani](https://github.com/sebhani).
911

1012
### Internal
1113

14+
* ⬆ Bump astral-sh/setup-uv from 2 to 3. PR [#1364](https://github.com/fastapi/full-stack-fastapi-template/pull/1364) by [@dependabot[bot]](https://github.com/apps/dependabot).
1215
* 👷 Update pre-commit end-of-file-fixer hook to exclude email-templates. PR [#1296](https://github.com/fastapi/full-stack-fastapi-template/pull/1296) by [@goabonga](https://github.com/goabonga).
1316
* ⬆ Bump tiangolo/issue-manager from 0.5.0 to 0.5.1. PR [#1332](https://github.com/fastapi/full-stack-fastapi-template/pull/1332) by [@dependabot[bot]](https://github.com/apps/dependabot).
1417
* 🔧 Run task by the same Python environment used to run Copier. PR [#1157](https://github.com/fastapi/full-stack-fastapi-template/pull/1157) by [@waketzheng](https://github.com/waketzheng).

0 commit comments

Comments
 (0)