from notifications.plugins import CONFIRM_TOKEN_RESEND_SECONDS,CONFIRM_TOKEN_TTL_SECONDS def serialize_confirmation_request(email: str,expires_at) -> dict: return { "email": email, "confirmation_sent": True, "expires_at": expires_at.isoformat() if expires_at else None, "expires_in": CONFIRM_TOKEN_TTL_SECONDS, "resend_after": CONFIRM_TOKEN_RESEND_SECONDS, } def serialize_confirmation_result(user,*,already_confirmed: bool = False) -> dict: """Deliberately narrow: this is an unauthenticated response, so no role or permissions.""" return { "email": user.email, "is_active": user.is_active, "already_confirmed": already_confirmed, }