feat(phase-2): implement domain verification system

Implements complete domain verification flow with:
- rel=me link verification service
- HTML fetching with security controls
- Rate limiting to prevent abuse
- Email validation utilities
- Authorization and verification API endpoints
- User-facing templates for authorization and verification flows

This completes Phase 2: Domain Verification as designed.

Tests:
- All Phase 2 unit tests passing
- Coverage: 85% overall
- Migration tests updated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-20 13:44:33 -07:00
parent 11ecd953d8
commit 074f74002c
28 changed files with 2283 additions and 14 deletions

View File

@@ -6,8 +6,6 @@ Provides database initialization, migration running, and health checks.
import logging
from pathlib import Path
from typing import Optional
from urllib.parse import urlparse
from sqlalchemy import create_engine, text
from sqlalchemy.engine import Engine
@@ -37,7 +35,7 @@ class Database:
database_url: SQLAlchemy database URL (e.g., sqlite:///./data/gondulf.db)
"""
self.database_url = database_url
self._engine: Optional[Engine] = None
self._engine: Engine | None = None
def ensure_database_directory(self) -> None:
"""

View File

@@ -0,0 +1,8 @@
-- Migration 002: Add two_factor column to domains table
-- Adds two-factor verification method support for Phase 2
-- Add two_factor column with default value false
ALTER TABLE domains ADD COLUMN two_factor BOOLEAN NOT NULL DEFAULT FALSE;
-- Record this migration
INSERT INTO migrations (version, description) VALUES (2, 'Add two_factor column to domains table for Phase 2');