메일 알림 시스템 추가
This commit is contained in:
parent
ddf12a851c
commit
3bf38c50df
22 changed files with 1769 additions and 31 deletions
|
|
@ -9,6 +9,7 @@ from __future__ import annotations
|
|||
|
||||
import hashlib
|
||||
import hmac
|
||||
import logging
|
||||
import secrets
|
||||
import time
|
||||
import uuid
|
||||
|
|
@ -19,6 +20,9 @@ from .auth_types import AccountStatus, RoleName
|
|||
from .config import settings
|
||||
from .db import get_pool
|
||||
from .runtime_policy import require_runtime_fallback_allowed, runtime_fallback_allowed
|
||||
from .services import notifications
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
|
|
@ -351,6 +355,24 @@ async def _runtime_tables_ready(conn) -> bool:
|
|||
AND table_name = 'session_state'
|
||||
AND column_name = 'turns_in_stage'
|
||||
) AS has_state_columns,
|
||||
EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_schema = 'app'
|
||||
AND table_name = 'turns'
|
||||
AND column_name = 'provider_events'
|
||||
) AS has_turn_provider_events,
|
||||
EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_schema = 'app'
|
||||
AND table_name = 'session_review_status'
|
||||
AND column_name IN (
|
||||
'worksheet_status',
|
||||
'worksheet_note',
|
||||
'worksheet_reviewed_at'
|
||||
)
|
||||
GROUP BY table_schema, table_name
|
||||
HAVING count(*) = 3
|
||||
) AS has_session_review_worksheet_columns,
|
||||
(
|
||||
SELECT count(*) = 4
|
||||
FROM app.stage_def
|
||||
|
|
@ -463,6 +485,8 @@ async def _runtime_tables_ready(conn) -> bool:
|
|||
and row["has_engine_config"]
|
||||
and row["has_session_columns"]
|
||||
and row["has_state_columns"]
|
||||
and row["has_turn_provider_events"]
|
||||
and row["has_session_review_worksheet_columns"]
|
||||
and row["has_stage_defs"]
|
||||
and row["has_admin_health_event"]
|
||||
and row["has_admin_health_daily_rollup"]
|
||||
|
|
@ -1813,6 +1837,16 @@ async def create_session(
|
|||
reactivate=False,
|
||||
)
|
||||
)
|
||||
if managed.account_status == "pending":
|
||||
try:
|
||||
await notifications.enqueue_account_pending_approval(
|
||||
user_id=managed.user_id,
|
||||
email=managed.email,
|
||||
display_name=managed.display_name,
|
||||
role=managed.role,
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.warning("account approval notification enqueue failed: %s", exc)
|
||||
expires_at = time.time() + settings.session_ttl_seconds
|
||||
user = SessionUser(
|
||||
user_id=managed.user_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue