mirror of
https://github.com/lightningcell/flask-2fa-auth.git
synced 2026-05-26 07:08:07 +00:00
Implement location tracking and suspicious login detection
- Added `track_login_location` function to monitor user login locations. - Introduced `LoginLocation` model to store login details including IP and geolocation. - Created `LocationApprovalToken` model for managing location approval tokens. - Enhanced OTP verification to include location tracking and alerts for suspicious logins. - Implemented email notifications for suspicious login attempts and location approvals. - Added `login_history` route to display user's login activity. - Updated templates for login history and email notifications. - Configured mail settings and added dependencies for email functionality. - Introduced utility classes for mail and location services.
This commit is contained in:
12
.env.example
12
.env.example
@@ -19,6 +19,18 @@ DATABASE_URL=sqlite:///app.db
|
||||
# Application Settings
|
||||
DEBUG=True
|
||||
|
||||
# Mail Configuration (for location alerts and notifications)
|
||||
MAIL_SERVER=smtp.gmail.com
|
||||
MAIL_PORT=587
|
||||
MAIL_USE_TLS=true
|
||||
MAIL_USERNAME=your-email@gmail.com
|
||||
MAIL_PASSWORD=your-app-password
|
||||
MAIL_DEFAULT_SENDER=noreply@flask2fa.com
|
||||
|
||||
# Location Security Settings
|
||||
MAX_LOGIN_ATTEMPTS=5
|
||||
SUSPICIOUS_LOGIN_THRESHOLD_KM=100
|
||||
|
||||
# Security Headers (Production only)
|
||||
# SESSION_COOKIE_SECURE=True
|
||||
# SESSION_COOKIE_HTTPONLY=True
|
||||
|
||||
Reference in New Issue
Block a user