- Add email verification with token-based validation - Integrate Google, Facebook, and Yahoo OAuth providers - Add OAuth configuration and email service modules - Update User model with email_verified, oauth_provider, oauth_id fields - Implement async password hashing/verification to prevent blocking - Add database migration script for new user fields - Create email verification page with professional UI - Update login page with social login buttons (Google, Facebook, Yahoo) - Add OAuth callback token handling - Implement scroll-to-top navigation component - Add 5-second real-time polling for Products and Services pages - Enhance About page with Apple-style scroll animations - Update Home and Contact pages with branding and business info - Optimize API cache with prefix-based clearing - Create comprehensive setup documentation and quick start guide - Fix login performance with ThreadPoolExecutor for bcrypt operations Performance improvements: - Login time optimized to ~220ms with async password verification - Real-time data updates every 5 seconds - Non-blocking password operations Security enhancements: - Email verification required for new accounts - OAuth integration for secure social login - Verification tokens expire after 24 hours - Password field nullable for OAuth users
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
import os
|
|
from authlib.integrations.starlette_client import OAuth
|
|
from starlette.config import Config
|
|
|
|
# Load environment variables
|
|
config = Config('.env')
|
|
|
|
# Initialize OAuth
|
|
oauth = OAuth(config)
|
|
|
|
# Google OAuth Configuration
|
|
oauth.register(
|
|
name='google',
|
|
client_id=os.getenv('GOOGLE_CLIENT_ID'),
|
|
client_secret=os.getenv('GOOGLE_CLIENT_SECRET'),
|
|
server_metadata_url='https://accounts.google.com/.well-known/openid-configuration',
|
|
client_kwargs={
|
|
'scope': 'openid email profile'
|
|
}
|
|
)
|
|
|
|
# Facebook OAuth Configuration
|
|
oauth.register(
|
|
name='facebook',
|
|
client_id=os.getenv('FACEBOOK_APP_ID'),
|
|
client_secret=os.getenv('FACEBOOK_APP_SECRET'),
|
|
authorize_url='https://www.facebook.com/v12.0/dialog/oauth',
|
|
authorize_params=None,
|
|
access_token_url='https://graph.facebook.com/v12.0/oauth/access_token',
|
|
access_token_params=None,
|
|
refresh_token_url=None,
|
|
client_kwargs={
|
|
'scope': 'email public_profile',
|
|
'token_endpoint_auth_method': 'client_secret_post'
|
|
}
|
|
)
|
|
|
|
# Yahoo OAuth Configuration
|
|
oauth.register(
|
|
name='yahoo',
|
|
client_id=os.getenv('YAHOO_CLIENT_ID'),
|
|
client_secret=os.getenv('YAHOO_CLIENT_SECRET'),
|
|
authorize_url='https://api.login.yahoo.com/oauth2/request_auth',
|
|
authorize_params=None,
|
|
access_token_url='https://api.login.yahoo.com/oauth2/get_token',
|
|
access_token_params=None,
|
|
client_kwargs={
|
|
'scope': 'openid email profile',
|
|
'token_endpoint_auth_method': 'client_secret_post'
|
|
}
|
|
)
|