Files
finance/backend/app/identity/mailer.py
T
k1nq d582f15681 feat: add tests for import polling, login page, money utilities, and query keys
- Implemented tests for import polling functionality, ensuring correct behavior for active and terminal import statuses.
- Created tests for the login page, validating user interactions and error handling.
- Added unit tests for money utility functions, covering parsing, formatting, and summation of monetary values.
- Developed tests for query keys, ensuring proper scoping and invalidation roots.

chore: setup testing environment and configuration

- Added setup file for testing with Vitest and Testing Library.
- Configured TypeScript and Vite for the frontend project.
- Created Docker and Nginx configurations for local development and production environments.
- Established a PostgreSQL initialization script for setting up application roles.

docs: add README and environment configuration for infra

- Included README for the infra directory, detailing local development setup and service descriptions.
- Created an example environment configuration file for local development with placeholders for sensitive information.
2026-09-14 09:26:33 +05:00

23 lines
933 B
Python

import smtplib
from email.message import EmailMessage
from app.config import get_settings
def send_token_email(*, recipient: str, token: str, kind: str) -> None:
settings = get_settings()
if not settings.smtp_host:
return
path = "invite/accept" if kind == "invite" else "reset-password"
link = f"{settings.public_base_url.rstrip('/')}/{path}?token={token}"
subject = "Finance invitation / Приглашение" if kind == "invite" else "Finance password reset"
message = EmailMessage()
message["From"] = settings.smtp_from
message["To"] = recipient
message["Subject"] = subject
message.set_content(f"Open this one-time link / Откройте одноразовую ссылку:\n\n{link}\n")
with smtplib.SMTP(settings.smtp_host, settings.smtp_port, timeout=10) as client:
if settings.smtp_use_tls:
client.starttls()
client.send_message(message)