add reset password endpoint

This commit is contained in:
2025-12-04 19:46:26 -03:00
parent d29ad3ceb6
commit b929c492c0
9 changed files with 129 additions and 36 deletions

View File

@@ -16,9 +16,9 @@ from passlib.hash import pbkdf2_sha256
from pydantic import UUID4, EmailStr
from boto3clients import dynamodb_client
from config import SESSION_EXPIRES_IN, USER_TABLE
from config import USER_TABLE
from .authentication import new_session
from .authentication import cookie
router = Router()
dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
@@ -74,7 +74,7 @@ def register(
compress=True,
body=asdict(new_user),
cookies=[
_cookie(existing['id']),
cookie(existing['id']),
],
)
@@ -86,22 +86,11 @@ def register(
compress=True,
body=asdict(new_user),
cookies=[
_cookie(new_user.id),
cookie(new_user.id),
],
)
def _cookie(user_id: str) -> Cookie:
return Cookie(
name='SID',
value=new_session(user_id),
http_only=True,
secure=True,
same_site=None,
max_age=SESSION_EXPIRES_IN,
)
def _create_user(*, user: User, password: str):
now_ = now()