Add IMAP configuration UI and sidebar navigation for email inbox
- Email settings page at /administration/email/ with IMAP config form - Connection test button to verify IMAP connectivity - Sidebar link "E-Mail Eingang" for quick access - AppConfiguration model extended with email category and password type - init_config command includes IMAP default settings - DB-based IMAP config with env var fallback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -91,10 +91,76 @@ class Command(BaseCommand):
|
||||
},
|
||||
]
|
||||
|
||||
# E-Mail / IMAP Settings
|
||||
email_settings = [
|
||||
{
|
||||
"key": "imap_host",
|
||||
"display_name": "IMAP Server",
|
||||
"description": "Hostname oder IP-Adresse des IMAP-Servers (z.B. mail.example.com)",
|
||||
"value": "",
|
||||
"default_value": "",
|
||||
"setting_type": "text",
|
||||
"category": "email",
|
||||
"order": 1,
|
||||
},
|
||||
{
|
||||
"key": "imap_port",
|
||||
"display_name": "IMAP Port",
|
||||
"description": "Port des IMAP-Servers (Standard: 993 für SSL, 143 für unverschlüsselt)",
|
||||
"value": "993",
|
||||
"default_value": "993",
|
||||
"setting_type": "number",
|
||||
"category": "email",
|
||||
"order": 2,
|
||||
},
|
||||
{
|
||||
"key": "imap_user",
|
||||
"display_name": "IMAP Benutzername",
|
||||
"description": "Benutzername / E-Mail-Adresse für die IMAP-Anmeldung",
|
||||
"value": "",
|
||||
"default_value": "",
|
||||
"setting_type": "text",
|
||||
"category": "email",
|
||||
"order": 3,
|
||||
},
|
||||
{
|
||||
"key": "imap_password",
|
||||
"display_name": "IMAP Passwort",
|
||||
"description": "Passwort für die IMAP-Anmeldung",
|
||||
"value": "",
|
||||
"default_value": "",
|
||||
"setting_type": "password",
|
||||
"category": "email",
|
||||
"order": 4,
|
||||
},
|
||||
{
|
||||
"key": "imap_folder",
|
||||
"display_name": "IMAP Ordner",
|
||||
"description": "Name des zu überwachenden Postfach-Ordners (Standard: INBOX)",
|
||||
"value": "INBOX",
|
||||
"default_value": "INBOX",
|
||||
"setting_type": "text",
|
||||
"category": "email",
|
||||
"order": 5,
|
||||
},
|
||||
{
|
||||
"key": "imap_use_ssl",
|
||||
"display_name": "SSL/TLS verwenden",
|
||||
"description": "Sichere Verbindung zum IMAP-Server (empfohlen)",
|
||||
"value": "True",
|
||||
"default_value": "True",
|
||||
"setting_type": "boolean",
|
||||
"category": "email",
|
||||
"order": 6,
|
||||
},
|
||||
]
|
||||
|
||||
all_settings = paperless_settings + email_settings
|
||||
|
||||
created_count = 0
|
||||
updated_count = 0
|
||||
|
||||
for setting_data in paperless_settings:
|
||||
for setting_data in all_settings:
|
||||
setting, created = AppConfiguration.objects.get_or_create(
|
||||
key=setting_data["key"], defaults=setting_data
|
||||
)
|
||||
|
||||
@@ -313,6 +313,7 @@ class AppConfiguration(models.Model):
|
||||
|
||||
SETTING_TYPE_CHOICES = [
|
||||
("text", "Text"),
|
||||
("password", "Password"),
|
||||
("number", "Number"),
|
||||
("boolean", "Boolean"),
|
||||
("url", "URL"),
|
||||
@@ -322,6 +323,7 @@ class AppConfiguration(models.Model):
|
||||
|
||||
CATEGORY_CHOICES = [
|
||||
("paperless", "Paperless Integration"),
|
||||
("email", "E-Mail / IMAP"),
|
||||
("general", "General Settings"),
|
||||
("corporate", "Corporate Identity"),
|
||||
("notifications", "Notifications"),
|
||||
|
||||
@@ -262,6 +262,7 @@ urlpatterns = [
|
||||
# Administration URLs
|
||||
path("administration/", views.administration, name="administration"),
|
||||
path("administration/settings/", views.app_settings, name="app_settings"),
|
||||
path("administration/email/", views.email_settings, name="email_settings"),
|
||||
path("administration/audit-log/", views.audit_log_list, name="audit_log_list"),
|
||||
path("administration/backup/", views.backup_management, name="backup_management"),
|
||||
path(
|
||||
|
||||
@@ -156,6 +156,7 @@ from .system import ( # noqa: F401
|
||||
user_login,
|
||||
user_logout,
|
||||
app_settings,
|
||||
email_settings,
|
||||
edit_help_box,
|
||||
two_factor_setup,
|
||||
two_factor_qr,
|
||||
|
||||
Reference in New Issue
Block a user