nordabiz/extensions.py
Maciej Pienczyn d5adf029aa refactor(phase2a): Extract auth + public blueprints with Alias Bridge
Phase 2a of modular monolith refactoring:

New blueprints:
- blueprints/auth/routes.py (1,040 lines, 20 routes)
  - login, logout, register, verify_2fa, settings_2fa
  - forgot_password, reset_password, verify_email
  - konto_dane, konto_prywatnosc, konto_bezpieczenstwo, konto_blokady
- blueprints/public/routes.py (862 lines, 11 routes)
  - index, company_detail, person_detail, search
  - dashboard, events, new_members, release_notes

Alias Bridge strategy:
- Both url_for('login') and url_for('auth.login') work
- Templates don't require changes (backward compatible)
- Original routes in app.py marked with _old_ prefix (dead code)

Next step: Cleanup dead code from app.py after production verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:28:18 +01:00

29 lines
758 B
Python

"""
Flask Extensions
================
Centralized Flask extension instances.
Extensions are initialized without app, then configured in create_app().
This pattern allows blueprints to import extensions without circular imports.
"""
from flask_wtf.csrf import CSRFProtect
from flask_login import LoginManager
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
# CSRF Protection
csrf = CSRFProtect()
# Login Manager
login_manager = LoginManager()
login_manager.login_view = 'auth.login'
login_manager.login_message = 'Zaloguj się, aby uzyskać dostęp do tej strony.'
# Rate Limiter (storage configured in app.py)
limiter = Limiter(
key_func=get_remote_address,
default_limits=["1000 per day", "200 per hour"]
)