fix error

This commit is contained in:
2025-12-04 10:56:36 -03:00
parent 2f76bd611c
commit c3917addfa
17 changed files with 127 additions and 52 deletions

View File

@@ -6,9 +6,11 @@ import boto3
if TYPE_CHECKING:
from mypy_boto3_cognito_idp import CognitoIdentityProviderClient
from mypy_boto3_dynamodb.client import DynamoDBClient
from mypy_boto3_sesv2.client import SESV2Client
else:
DynamoDBClient = object
CognitoIdentityProviderClient = object
SESV2Client = object
def get_dynamodb_client() -> DynamoDBClient:
@@ -20,3 +22,4 @@ def get_dynamodb_client() -> DynamoDBClient:
dynamodb_client: DynamoDBClient = get_dynamodb_client()
idp_client: CognitoIdentityProviderClient = boto3.client('cognito-idp')
sesv2_client: SESV2Client = boto3.client('sesv2')

View File

@@ -2,6 +2,8 @@ import os
ISSUER: str = os.getenv('ISSUER') # type: ignore
EMAIL_SENDER = ('EDUSEG®', 'noreply@eduseg.com.br')
OAUTH2_TABLE: str = os.getenv('OAUTH2_TABLE') # type: ignore
OAUTH2_REFRESH_TOKEN_EXPIRES_IN = 86_400 * 7 # 7 days
OAUTH2_SCOPES_SUPPORTED: list[str] = [

View File

@@ -0,0 +1,20 @@
from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.data_classes import (
EventBridgeEvent,
event_source,
)
from aws_lambda_powertools.utilities.typing import LambdaContext
from boto3clients import sesv2_client
from config import EMAIL_SENDER
logger = Logger(__name__)
@event_source(data_class=EventBridgeEvent)
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
new_image = event.detail['new_image']
# Key pattern `PASSWORD_RESET#{code}`
*_, code = new_image['sk'].split('#')
return True

View File

@@ -2,11 +2,12 @@ from typing import Annotated
from aws_lambda_powertools.event_handler.api_gateway import Router
from aws_lambda_powertools.event_handler.openapi.params import Body
from layercake.extra_types import CpfStr
from pydantic import EmailStr
router = Router()
@router.post('/forgot')
def forgot(email: Annotated[EmailStr, Body(embed=True)]):
def forgot(email: Annotated[EmailStr | CpfStr, Body(embed=True)]):
return {}