File tree 1 file changed +6
-2
lines changed
{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
from typing import Any , Union
2
2
3
+ from bson import ObjectId
4
+
3
5
from fastapi import APIRouter , Body , Depends , HTTPException
4
6
from fastapi .security import OAuth2PasswordRequestForm
5
7
from motor .core import AgnosticDatabase
15
17
16
18
router = APIRouter ()
17
19
20
+
21
+
18
22
"""
19
23
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Authentication_Cheat_Sheet.md
20
24
Specifies minimum criteria:
@@ -64,7 +68,7 @@ async def validate_magic_link(
64
68
"""
65
69
claim_in = deps .get_magic_token (token = obj_in .claim )
66
70
# Get the user
67
- user = await crud .user .get (db , id = magic_in .sub )
71
+ user = await crud .user .get (db , id = ObjectId ( magic_in .sub ) )
68
72
# Test the claims
69
73
if (
70
74
(claim_in .sub == magic_in .sub )
@@ -241,7 +245,7 @@ async def reset_password(
241
245
"""
242
246
claim_in = deps .get_magic_token (token = claim )
243
247
# Get the user
244
- user = await crud .user .get (db , id = magic_in .sub )
248
+ user = await crud .user .get (db , id = ObjectId ( magic_in .sub ) )
245
249
# Test the claims
246
250
if (
247
251
(claim_in .sub == magic_in .sub )
You can’t perform that action at this time.
0 commit comments