# django-myuser
A vibe coded comprehensive Django package for user authentication, and user data management.
Built for very specific use case for my personal needs. Use at your own risk. Except for this paragraph, almost entirely is written by LLMs.
[](https://www.python.org/downloads/)
[](https://www.djangoproject.com/)
[](https://opensource.org/licenses/MIT)
## Features
🔐 **Advanced JWT Authentication**
- JWT token authentication with refresh token rotation
- Secure server-side logout with token blacklisting
- Social authentication (Google, GitHub, Facebook)
👤 **User Management**
- Extended user profiles with GDPR compliance
- Soft deletion with UUID primary keys
- User session tracking and management
🛡️ **Security & Compliance**
- GDPR data export and deletion requests with file-based downloads
- Pluggable data export system for custom data collection
- Automatic cleanup of expired export files
- Comprehensive audit logging
- Rate limiting on sensitive endpoints
- Marketing consent management
📧 **Email Integration**
- Async email processing with Celery
- Customizable email templates
- Password reset and email verification
## Quick Start
### 1. Installation
```bash
pip install django-myuser
```
### 2. Add to INSTALLED_APPS
```python
INSTALLED_APPS = [
# Django apps
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
# Third-party apps
'rest_framework',
'rest_framework.authtoken',
'rest_framework_simplejwt',
'rest_framework_simplejwt.token_blacklist',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.facebook',
'dj_rest_auth',
'dj_rest_auth.registration',
# django-myuser
'django_myuser',
]
```
### 3. Include URLs
```python
# urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/auth/', include('django_myuser.urls')),
]
```
### 4. Run Migrations
```bash
python manage.py migrate
```
### 5. Set Up Celery Worker (Optional but recommended)
```bash
celery -A your_project worker -l info
```
## Configuration
### Required Settings
```python
# settings.py
# Site ID for allauth
SITE_ID = 1
# Redis for Celery and rate limiting
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
# REST Framework configuration
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
],
'DEFAULT_THROTTLE_CLASSES': [
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.UserRateThrottle'
],
'DEFAULT_THROTTLE_RATES': {
'anon': '100/day',
'user': '1000/day'
}
}
```
### JWT Configuration
```python
from datetime import timedelta
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
'ROTATE_REFRESH_TOKENS': True,
'BLACKLIST_AFTER_ROTATION': True,
'UPDATE_LAST_LOGIN': False,
'ALGORITHM': 'HS256',
'SIGNING_KEY': SECRET_KEY,
'VERIFYING_KEY': None,
'AUDIENCE': None,
'ISSUER': None,
'JSON_ENCODER': None,
'JWK_URL': None,
'LEEWAY': 0,
'AUTH_HEADER_TYPES': ('Bearer',),
'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION',
'USER_ID_FIELD': 'id',
'USER_ID_CLAIM': 'user_id',
'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule',
'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),
'TOKEN_TYPE_CLAIM': 'token_type',
'JTI_CLAIM': 'jti',
'SLIDING_TOKEN_REFRESH_EXP_CLAIM': 'refresh_exp',
'SLIDING_TOKEN_LIFETIME': timedelta(minutes=5),
'SLIDING_TOKEN_REFRESH_LIFETIME': timedelta(days=1),
}
```
### Social Authentication
```python
# Social account providers
SOCIALACCOUNT_PROVIDERS = {
'google': {
'SCOPE': [
'profile',
'email',
],
'AUTH_PARAMS': {
'access_type': 'online',
}
},
'github': {
'SCOPE': [
'user:email',
],
},
'facebook': {
'METHOD': 'oauth2',
'SDK_URL': '//connect.facebook.net/{locale}/sdk.js',
'SCOPE': ['email', 'public_profile'],
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
'INIT_PARAMS': {'cookie': True},
'FIELDS': [
'id',
'first_name',
'last_name',
'middle_name',
'name',
'name_format',
'picture',
'short_name'
],
'EXCHANGE_TOKEN': True,
'LOCALE_FUNC': lambda request: 'en_US',
'VERIFIED_EMAIL': False,
'VERSION': 'v13.0',
}
}
# Social account adapter
SOCIALACCOUNT_ADAPTER = 'django_myuser.adapters.MySocialAccountAdapter'
```
### Email Configuration
```python
# Email backend (configure for production)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# For production, use SMTP:
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# EMAIL_HOST = 'smtp.gmail.com'
# EMAIL_PORT = 587
# EMAIL_USE_TLS = True
# EMAIL_HOST_USER = 'your-email@gmail.com'
# EMAIL_HOST_PASSWORD = 'your-password'
# Default from email
DEFAULT_FROM_EMAIL = 'noreply@yourdomain.com'
```
### Allauth Configuration
```python
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_USER_MODEL_EMAIL_FIELD = 'email'
```
## API Endpoints
### Authentication Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/auth/token/` | POST | Obtain JWT token pair |
| `/api/auth/token/refresh/` | POST | Refresh access token |
| `/api/auth/token/verify/` | POST | Verify token validity |
| `/api/auth/logout/` | POST | Logout and blacklist tokens |
### Social Authentication
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/auth/social/google/` | POST | Google OAuth login |
| `/api/auth/social/github/` | POST | GitHub OAuth login |
| `/api/auth/social/facebook/` | POST | Facebook OAuth login |
### User Management
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/auth/profile/` | GET/PUT | User profile management |
| `/api/auth/data-requests/` | GET/POST | GDPR data requests |
| `/api/auth/data-export/download/{token}/` | GET | Download export files |
| `/api/auth/sessions/` | GET | List active sessions |
| `/api/auth/sessions/{id}/` | DELETE | Revoke specific session |
### Social Account Management
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/auth/social/accounts/` | GET | List connected social accounts |
| `/api/auth/social/accounts/status/` | GET | Check connection status |
| `/api/auth/social/accounts/{provider}/disconnect/` | POST | Disconnect social account |
## Models
### BaseModel
Abstract model with UUID primary key, timestamps, and soft deletion.
### Profile
Extends user with marketing consent and additional profile data.
### DataRequest
Handles GDPR data export and deletion requests.
### UserSession
Tracks active user sessions for security monitoring.
### AuditLog
Comprehensive logging of security-sensitive events.
### DataExportFile
Manages secure download tokens and file lifecycle for GDPR exports.
## Email Templates
The package includes customizable email templates for:
- Email confirmation
- Password reset
- Welcome messages
- Data export notifications
- Account deletion confirmations
- Password change alerts
### Customizing Templates
Override templates by creating files in your project:
```
templates/
├── account/
│ └── email/
│ ├── email_confirmation_message.html
│ ├── password_reset_key_message.html
│ └── welcome_message.html
└── socialaccount/
└── email/
└── account_connected.html
```
## GDPR Compliance & Data Export System
### Data Export with File Downloads
Users can request data exports that are processed asynchronously and delivered via secure download links:
```python
# Request export
POST /api/auth/data-requests/
{
"request_type": "EXPORT"
}
# User receives email with download link when ready
# Download via secure token (no authentication required)
GET /api/auth/data-export/download/{secure-token}/
```
**Export Features:**
- Multi-file ZIP archives with organized data (JSON, CSV, JSONL)
- Memory-efficient processing for large datasets
- Secure token-based downloads with expiration
- Automatic cleanup of expired files
- Email notifications when export is ready
### Custom Data Exporters
Create custom exporters for application-specific data:
```python
# settings.py
DJANGO_MYUSER = {
'DATA_EXPORTER_CLASS': 'myapp.exporters.CustomUserDataExporter',
'EXPORT_FILE_PATH': 'user_exports/',
'EXPORT_FILE_RETENTION_DAYS': 14,
}
# myapp/exporters.py
from django_myuser.exporters import UserDataExporter
class CustomUserDataExporter(UserDataExporter):
def generate_data(self, data_request, user):
with self.create_export_builder(user) as builder:
# Add custom app data
builder.add_json_file('orders.json', self.get_user_orders(user))
builder.add_csv_file('activity.csv', self.get_user_activity(user))
return builder.create_archive('custom_export')
```
### Data Deletion
Users can request account deletion:
```python
POST /api/auth/data-requests/
{
"request_type": "DELETE"
}
```
### Marketing Consent
Track and manage marketing consent:
```python
PUT /api/auth/profile/
{
"marketing_consent": true
}
```
## Rate Limiting
Built-in rate limiting on sensitive endpoints:
```python
# Custom throttle rates
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_RATES': {
'login': '10/min',
'password_reset': '5/hour',
'data_request': '2/day',
}
}
```
## Audit Logging
All security events are automatically logged:
- Login/logout events
- Password changes
- Social account connections
- Data requests
- Suspicious activities
Access logs through the Django admin or API.
## Running Celery
Start Celery worker for async email processing and data exports:
```bash
# Basic worker
celery -A your_project worker -l info
# With beat scheduler (recommended for cleanup tasks)
celery -A your_project worker -B -l info
# Separate beat process
celery -A your_project beat -l info
# Periodic cleanup of expired export files
celery -A your_project worker -B --scheduler=django_celery_beat.schedulers:DatabaseScheduler
```
### Celery Tasks
The package includes these Celery tasks:
- `send_async_email` - Send notification emails
- `process_data_request` - Process export/deletion requests
- `cleanup_expired_exports` - Remove expired export files (run daily)
## Testing
Run the test suite:
```bash
# Install test dependencies
pip install pytest pytest-django pytest-cov factory-boy
# Run tests
pytest
# Run with coverage
pytest --cov=django_myuser
```
## Security Considerations
- Always use HTTPS in production
- Configure proper CORS settings
- Set strong JWT signing keys
- Use Redis for production Celery broker
- Implement proper rate limiting
- Monitor audit logs for suspicious activity
- Regular security updates
## Contributing
1. Fork the repository: https://github.com/jangedoo/django-myuser
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Run the test suite
6. Submit a pull request
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Support
- **Issues**: https://github.com/jangedoo/django-myuser/issues
- **Documentation**: See `docs/` directory for detailed guides
- **Discussions**: https://github.com/jangedoo/django-myuser/discussions
## Changelog
See [CHANGELOG.md](CHANGELOG.md) for version history and changes.
Raw data
{
"_id": null,
"home_page": null,
"name": "django-myuser",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "django, authentication, jwt, social-auth, gdpr, user-management, rest-api, celery, audit-logging",
"author": "Sanjaya Subedi",
"author_email": "jangedoo@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1d/2f/a1883d4ecd659f85106dd6545e0929dae0ec143f611ae70b0a4220bccd1a/django_myuser-0.0.5.tar.gz",
"platform": null,
"description": "# django-myuser\n\nA vibe coded comprehensive Django package for user authentication, and user data management.\nBuilt for very specific use case for my personal needs. Use at your own risk. Except for this paragraph, almost entirely is written by LLMs.\n\n[](https://www.python.org/downloads/)\n[](https://www.djangoproject.com/)\n[](https://opensource.org/licenses/MIT)\n\n## Features\n\n\ud83d\udd10 **Advanced JWT Authentication**\n- JWT token authentication with refresh token rotation\n- Secure server-side logout with token blacklisting\n- Social authentication (Google, GitHub, Facebook)\n\n\ud83d\udc64 **User Management**\n- Extended user profiles with GDPR compliance\n- Soft deletion with UUID primary keys\n- User session tracking and management\n\n\ud83d\udee1\ufe0f **Security & Compliance**\n- GDPR data export and deletion requests with file-based downloads\n- Pluggable data export system for custom data collection\n- Automatic cleanup of expired export files\n- Comprehensive audit logging\n- Rate limiting on sensitive endpoints\n- Marketing consent management\n\n\ud83d\udce7 **Email Integration**\n- Async email processing with Celery\n- Customizable email templates\n- Password reset and email verification\n\n## Quick Start\n\n### 1. Installation\n\n```bash\npip install django-myuser\n```\n\n### 2. Add to INSTALLED_APPS\n\n```python\nINSTALLED_APPS = [\n # Django apps\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n 'django.contrib.sites',\n \n # Third-party apps\n 'rest_framework',\n 'rest_framework.authtoken',\n 'rest_framework_simplejwt',\n 'rest_framework_simplejwt.token_blacklist',\n 'allauth',\n 'allauth.account',\n 'allauth.socialaccount',\n 'allauth.socialaccount.providers.google',\n 'allauth.socialaccount.providers.github',\n 'allauth.socialaccount.providers.facebook',\n 'dj_rest_auth',\n 'dj_rest_auth.registration',\n \n # django-myuser\n 'django_myuser',\n]\n```\n\n### 3. Include URLs\n\n```python\n# urls.py\nfrom django.contrib import admin\nfrom django.urls import path, include\n\nurlpatterns = [\n path('admin/', admin.site.urls),\n path('api/auth/', include('django_myuser.urls')),\n]\n```\n\n### 4. Run Migrations\n\n```bash\npython manage.py migrate\n```\n\n### 5. Set Up Celery Worker (Optional but recommended)\n\n```bash\ncelery -A your_project worker -l info\n```\n\n## Configuration\n\n### Required Settings\n\n```python\n# settings.py\n\n# Site ID for allauth\nSITE_ID = 1\n\n# Redis for Celery and rate limiting\nCELERY_BROKER_URL = 'redis://localhost:6379/0'\nCELERY_RESULT_BACKEND = 'redis://localhost:6379/0'\n\n# REST Framework configuration\nREST_FRAMEWORK = {\n 'DEFAULT_AUTHENTICATION_CLASSES': [\n 'rest_framework_simplejwt.authentication.JWTAuthentication',\n ],\n 'DEFAULT_PERMISSION_CLASSES': [\n 'rest_framework.permissions.IsAuthenticated',\n ],\n 'DEFAULT_THROTTLE_CLASSES': [\n 'rest_framework.throttling.AnonRateThrottle',\n 'rest_framework.throttling.UserRateThrottle'\n ],\n 'DEFAULT_THROTTLE_RATES': {\n 'anon': '100/day',\n 'user': '1000/day'\n }\n}\n```\n\n### JWT Configuration\n\n```python\nfrom datetime import timedelta\n\nSIMPLE_JWT = {\n 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),\n 'REFRESH_TOKEN_LIFETIME': timedelta(days=1),\n 'ROTATE_REFRESH_TOKENS': True,\n 'BLACKLIST_AFTER_ROTATION': True,\n 'UPDATE_LAST_LOGIN': False,\n 'ALGORITHM': 'HS256',\n 'SIGNING_KEY': SECRET_KEY,\n 'VERIFYING_KEY': None,\n 'AUDIENCE': None,\n 'ISSUER': None,\n 'JSON_ENCODER': None,\n 'JWK_URL': None,\n 'LEEWAY': 0,\n 'AUTH_HEADER_TYPES': ('Bearer',),\n 'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION',\n 'USER_ID_FIELD': 'id',\n 'USER_ID_CLAIM': 'user_id',\n 'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule',\n 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),\n 'TOKEN_TYPE_CLAIM': 'token_type',\n 'JTI_CLAIM': 'jti',\n 'SLIDING_TOKEN_REFRESH_EXP_CLAIM': 'refresh_exp',\n 'SLIDING_TOKEN_LIFETIME': timedelta(minutes=5),\n 'SLIDING_TOKEN_REFRESH_LIFETIME': timedelta(days=1),\n}\n```\n\n### Social Authentication\n\n```python\n# Social account providers\nSOCIALACCOUNT_PROVIDERS = {\n 'google': {\n 'SCOPE': [\n 'profile',\n 'email',\n ],\n 'AUTH_PARAMS': {\n 'access_type': 'online',\n }\n },\n 'github': {\n 'SCOPE': [\n 'user:email',\n ],\n },\n 'facebook': {\n 'METHOD': 'oauth2',\n 'SDK_URL': '//connect.facebook.net/{locale}/sdk.js',\n 'SCOPE': ['email', 'public_profile'],\n 'AUTH_PARAMS': {'auth_type': 'reauthenticate'},\n 'INIT_PARAMS': {'cookie': True},\n 'FIELDS': [\n 'id',\n 'first_name',\n 'last_name',\n 'middle_name',\n 'name',\n 'name_format',\n 'picture',\n 'short_name'\n ],\n 'EXCHANGE_TOKEN': True,\n 'LOCALE_FUNC': lambda request: 'en_US',\n 'VERIFIED_EMAIL': False,\n 'VERSION': 'v13.0',\n }\n}\n\n# Social account adapter\nSOCIALACCOUNT_ADAPTER = 'django_myuser.adapters.MySocialAccountAdapter'\n```\n\n### Email Configuration\n\n```python\n# Email backend (configure for production)\nEMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\n\n# For production, use SMTP:\n# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'\n# EMAIL_HOST = 'smtp.gmail.com'\n# EMAIL_PORT = 587\n# EMAIL_USE_TLS = True\n# EMAIL_HOST_USER = 'your-email@gmail.com'\n# EMAIL_HOST_PASSWORD = 'your-password'\n\n# Default from email\nDEFAULT_FROM_EMAIL = 'noreply@yourdomain.com'\n```\n\n### Allauth Configuration\n\n```python\nACCOUNT_EMAIL_REQUIRED = True\nACCOUNT_EMAIL_VERIFICATION = 'mandatory'\nACCOUNT_USERNAME_REQUIRED = False\nACCOUNT_AUTHENTICATION_METHOD = 'email'\nACCOUNT_UNIQUE_EMAIL = True\nACCOUNT_USER_MODEL_USERNAME_FIELD = None\nACCOUNT_USER_MODEL_EMAIL_FIELD = 'email'\n```\n\n## API Endpoints\n\n### Authentication Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/auth/token/` | POST | Obtain JWT token pair |\n| `/api/auth/token/refresh/` | POST | Refresh access token |\n| `/api/auth/token/verify/` | POST | Verify token validity |\n| `/api/auth/logout/` | POST | Logout and blacklist tokens |\n\n### Social Authentication\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/auth/social/google/` | POST | Google OAuth login |\n| `/api/auth/social/github/` | POST | GitHub OAuth login |\n| `/api/auth/social/facebook/` | POST | Facebook OAuth login |\n\n### User Management\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/auth/profile/` | GET/PUT | User profile management |\n| `/api/auth/data-requests/` | GET/POST | GDPR data requests |\n| `/api/auth/data-export/download/{token}/` | GET | Download export files |\n| `/api/auth/sessions/` | GET | List active sessions |\n| `/api/auth/sessions/{id}/` | DELETE | Revoke specific session |\n\n### Social Account Management\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/auth/social/accounts/` | GET | List connected social accounts |\n| `/api/auth/social/accounts/status/` | GET | Check connection status |\n| `/api/auth/social/accounts/{provider}/disconnect/` | POST | Disconnect social account |\n\n## Models\n\n### BaseModel\nAbstract model with UUID primary key, timestamps, and soft deletion.\n\n### Profile\nExtends user with marketing consent and additional profile data.\n\n### DataRequest\nHandles GDPR data export and deletion requests.\n\n### UserSession\nTracks active user sessions for security monitoring.\n\n### AuditLog\nComprehensive logging of security-sensitive events.\n\n### DataExportFile\nManages secure download tokens and file lifecycle for GDPR exports.\n\n## Email Templates\n\nThe package includes customizable email templates for:\n\n- Email confirmation\n- Password reset\n- Welcome messages\n- Data export notifications\n- Account deletion confirmations\n- Password change alerts\n\n### Customizing Templates\n\nOverride templates by creating files in your project:\n\n```\ntemplates/\n\u251c\u2500\u2500 account/\n\u2502 \u2514\u2500\u2500 email/\n\u2502 \u251c\u2500\u2500 email_confirmation_message.html\n\u2502 \u251c\u2500\u2500 password_reset_key_message.html\n\u2502 \u2514\u2500\u2500 welcome_message.html\n\u2514\u2500\u2500 socialaccount/\n \u2514\u2500\u2500 email/\n \u2514\u2500\u2500 account_connected.html\n```\n\n## GDPR Compliance & Data Export System\n\n### Data Export with File Downloads\nUsers can request data exports that are processed asynchronously and delivered via secure download links:\n\n```python\n# Request export\nPOST /api/auth/data-requests/\n{\n \"request_type\": \"EXPORT\"\n}\n\n# User receives email with download link when ready\n# Download via secure token (no authentication required)\nGET /api/auth/data-export/download/{secure-token}/\n```\n\n**Export Features:**\n- Multi-file ZIP archives with organized data (JSON, CSV, JSONL)\n- Memory-efficient processing for large datasets\n- Secure token-based downloads with expiration\n- Automatic cleanup of expired files\n- Email notifications when export is ready\n\n### Custom Data Exporters\nCreate custom exporters for application-specific data:\n\n```python\n# settings.py\nDJANGO_MYUSER = {\n 'DATA_EXPORTER_CLASS': 'myapp.exporters.CustomUserDataExporter',\n 'EXPORT_FILE_PATH': 'user_exports/',\n 'EXPORT_FILE_RETENTION_DAYS': 14,\n}\n\n# myapp/exporters.py\nfrom django_myuser.exporters import UserDataExporter\n\nclass CustomUserDataExporter(UserDataExporter):\n def generate_data(self, data_request, user):\n with self.create_export_builder(user) as builder:\n # Add custom app data\n builder.add_json_file('orders.json', self.get_user_orders(user))\n builder.add_csv_file('activity.csv', self.get_user_activity(user))\n \n return builder.create_archive('custom_export')\n```\n\n### Data Deletion\nUsers can request account deletion:\n\n```python\nPOST /api/auth/data-requests/\n{\n \"request_type\": \"DELETE\"\n}\n```\n\n### Marketing Consent\nTrack and manage marketing consent:\n\n```python\nPUT /api/auth/profile/\n{\n \"marketing_consent\": true\n}\n```\n\n## Rate Limiting\n\nBuilt-in rate limiting on sensitive endpoints:\n\n```python\n# Custom throttle rates\nREST_FRAMEWORK = {\n 'DEFAULT_THROTTLE_RATES': {\n 'login': '10/min',\n 'password_reset': '5/hour',\n 'data_request': '2/day',\n }\n}\n```\n\n## Audit Logging\n\nAll security events are automatically logged:\n\n- Login/logout events\n- Password changes\n- Social account connections\n- Data requests\n- Suspicious activities\n\nAccess logs through the Django admin or API.\n\n## Running Celery\n\nStart Celery worker for async email processing and data exports:\n\n```bash\n# Basic worker\ncelery -A your_project worker -l info\n\n# With beat scheduler (recommended for cleanup tasks)\ncelery -A your_project worker -B -l info\n\n# Separate beat process\ncelery -A your_project beat -l info\n\n# Periodic cleanup of expired export files\ncelery -A your_project worker -B --scheduler=django_celery_beat.schedulers:DatabaseScheduler\n```\n\n### Celery Tasks\nThe package includes these Celery tasks:\n- `send_async_email` - Send notification emails\n- `process_data_request` - Process export/deletion requests \n- `cleanup_expired_exports` - Remove expired export files (run daily)\n\n## Testing\n\nRun the test suite:\n\n```bash\n# Install test dependencies\npip install pytest pytest-django pytest-cov factory-boy\n\n# Run tests\npytest\n\n# Run with coverage\npytest --cov=django_myuser\n```\n\n## Security Considerations\n\n- Always use HTTPS in production\n- Configure proper CORS settings\n- Set strong JWT signing keys\n- Use Redis for production Celery broker\n- Implement proper rate limiting\n- Monitor audit logs for suspicious activity\n- Regular security updates\n\n## Contributing\n\n1. Fork the repository: https://github.com/jangedoo/django-myuser\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Run the test suite\n6. Submit a pull request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- **Issues**: https://github.com/jangedoo/django-myuser/issues\n- **Documentation**: See `docs/` directory for detailed guides\n- **Discussions**: https://github.com/jangedoo/django-myuser/discussions\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for version history and changes.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A comprehensive Django package for advanced user authentication, user data management",
"version": "0.0.5",
"project_urls": null,
"split_keywords": [
"django",
" authentication",
" jwt",
" social-auth",
" gdpr",
" user-management",
" rest-api",
" celery",
" audit-logging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "79e92fab82af59f8670495df38bb63346b66b1f5a28f8e7c1f4ab980d5f48b93",
"md5": "53d8ced3b7a17f69fb7b2f92fbf3e4d4",
"sha256": "6784edd5813de64e86f1d8f290d0f1d9314c5f78568bb93e5435f7ea19a31d3c"
},
"downloads": -1,
"filename": "django_myuser-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "53d8ced3b7a17f69fb7b2f92fbf3e4d4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 47397,
"upload_time": "2025-08-30T19:29:04",
"upload_time_iso_8601": "2025-08-30T19:29:04.152775Z",
"url": "https://files.pythonhosted.org/packages/79/e9/2fab82af59f8670495df38bb63346b66b1f5a28f8e7c1f4ab980d5f48b93/django_myuser-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1d2fa1883d4ecd659f85106dd6545e0929dae0ec143f611ae70b0a4220bccd1a",
"md5": "834d05caad48887042bd6f8df629817f",
"sha256": "d7165ca25404f43d9945147e298e7fb718e380857c661c62ad0088ea63eaae3f"
},
"downloads": -1,
"filename": "django_myuser-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "834d05caad48887042bd6f8df629817f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 32978,
"upload_time": "2025-08-30T19:29:05",
"upload_time_iso_8601": "2025-08-30T19:29:05.544993Z",
"url": "https://files.pythonhosted.org/packages/1d/2f/a1883d4ecd659f85106dd6545e0929dae0ec143f611ae70b0a4220bccd1a/django_myuser-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-30 19:29:05",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "django-myuser"
}