Phase A: Close fixed issues (#7, #8, #9), add server/ user/ to .gitignore, increase extractor timeout to 30 min. Phase B: Add 10 new tests — access request lifecycle (4), CLI admin commands (5), sync subprocess trigger (1). 578 tests passing. Phase C: Delete entire webapp/ directory (24,800 lines) — legacy Flask app fully replaced by FastAPI app/. Fix auth providers to use app.instance_config instead of webapp.config. Update CLAUDE.md. Delete 6 webapp-only test files. Fix Jira service config imports.
59 lines
1.3 KiB
Python
59 lines
1.3 KiB
Python
"""
|
|
Email/password authentication provider.
|
|
|
|
Email/password authentication (Flask blueprint).
|
|
Available only when SENDGRID_API_KEY is configured.
|
|
"""
|
|
|
|
import logging
|
|
|
|
from flask import Blueprint
|
|
|
|
import os
|
|
|
|
from auth import AuthProvider
|
|
|
|
|
|
class _Config:
|
|
SENDGRID_API_KEY = os.environ.get("SENDGRID_API_KEY", "")
|
|
|
|
|
|
Config = _Config
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class PasswordAuthProvider(AuthProvider):
|
|
"""Email/password authentication provider for external users."""
|
|
|
|
def get_name(self) -> str:
|
|
return "password"
|
|
|
|
def get_display_name(self) -> str:
|
|
return "Email"
|
|
|
|
def get_blueprint(self) -> Blueprint:
|
|
# Legacy Flask blueprint — removed with webapp/
|
|
return Blueprint("password_auth", __name__)
|
|
|
|
def get_login_button(self) -> dict:
|
|
return {
|
|
"text": "Sign in with Email",
|
|
"url": "/login/email",
|
|
"icon_html": "",
|
|
"subtitle": "For external users (investors, partners).",
|
|
"order": 20,
|
|
"css_class": "btn-secondary",
|
|
"visible": True,
|
|
}
|
|
|
|
def is_available(self) -> bool:
|
|
return bool(Config.SENDGRID_API_KEY)
|
|
|
|
def init_app(self, app) -> None:
|
|
"""No additional initialization needed."""
|
|
pass
|
|
|
|
|
|
# Module-level provider instance for auto-discovery
|
|
provider = PasswordAuthProvider()
|