Prune unverified accounts

This commit is contained in:
2025-11-22 10:44:50 +01:00
parent 87471e033e
commit 983d10ea97
5 changed files with 100 additions and 74 deletions

View File

@@ -39,8 +39,16 @@ docker-compose up
# Debug mode with hot-reload # Debug mode with hot-reload
docker-compose -f docker-compose.debug.yml up docker-compose -f docker-compose.debug.yml up
# Manual cleanup of unverified accounts
docker exec timetrack-timetrack-1 python cleanup_unverified_accounts.py
# Dry run to see what would be deleted
docker exec timetrack-timetrack-1 python cleanup_unverified_accounts.py --dry-run
``` ```
**Note:** Unverified accounts are automatically cleaned up every hour via cron job in the Docker container.
## Database Operations ## Database Operations
### Flask-Migrate Commands ### Flask-Migrate Commands
@@ -187,6 +195,7 @@ When modifying billing/invoice features:
- Two-factor authentication (2FA) using TOTP - Two-factor authentication (2FA) using TOTP
- Session-based authentication with "Remember Me" option - Session-based authentication with "Remember Me" option
- Email verification for new accounts (configurable) - Email verification for new accounts (configurable)
- Automatic cleanup of unverified accounts after 24 hours
### Mobile UI Features ### Mobile UI Features
- Progressive Web App (PWA) manifest for installability - Progressive Web App (PWA) manifest for installability

View File

@@ -14,6 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \ build-essential \
python3-dev \ python3-dev \
postgresql-client \ postgresql-client \
cron \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
@@ -35,6 +36,12 @@ RUN pip install gunicorn==21.2.0
# Copy the rest of the application # Copy the rest of the application
COPY . . COPY . .
# Setup cron job for cleanup
COPY docker-cron /etc/cron.d/cleanup-cron
RUN chmod 0644 /etc/cron.d/cleanup-cron && \
crontab /etc/cron.d/cleanup-cron && \
touch /var/log/cron.log
# Create the SQLite database directory with proper permissions # Create the SQLite database directory with proper permissions
RUN mkdir -p /app/instance && chmod 777 /app/instance RUN mkdir -p /app/instance && chmod 777 /app/instance

View File

@@ -73,6 +73,16 @@ if [ -f "migrations_old/run_postgres_migrations.py" ]; then
echo "Found old migration system. Consider removing after confirming Flask-Migrate is working." echo "Found old migration system. Consider removing after confirming Flask-Migrate is working."
fi fi
# Start cron service for scheduled tasks
echo ""
echo "=== Starting Cron Service ==="
service cron start
if [ $? -eq 0 ]; then
echo "✅ Cron service started for scheduled cleanup tasks"
else
echo "⚠️ Failed to start cron service, cleanup tasks won't run automatically"
fi
# Start the Flask application with gunicorn # Start the Flask application with gunicorn
echo "" echo ""
echo "=== Starting Application ===" echo "=== Starting Application ==="