Convert iRedMail from REST API to direct MySQL (vmail DB) + per-company integration
- Replace IRedMailClient REST API class with direct MySQL/PDO connection to vmail database - Move iRedMail config from global config table to per-company integrations (like Zammad) - Add iRedMail integration card to API settings with DB host/name/user/password/port fields - Add iRedMail checkbox to integrations section in company settings - Change Hallinta tab visibility: show for admins (not just superadmins) when module enabled - API endpoints now use requireCompany() + requireSuperAdmin() and get config from integrations - Password hashing uses SSHA512 (iRedMail default) - Mask db_password in API responses (like token masking for Zammad) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
64
index.html
64
index.html
@@ -1520,7 +1520,6 @@
|
||||
<div class="main-container">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;">
|
||||
<h3 style="color:var(--primary-dark);margin:0;">Sähköpostinhallinta (iRedMail)</h3>
|
||||
<button class="btn-secondary" id="btn-iredmail-settings">⚙ Asetukset</button>
|
||||
</div>
|
||||
|
||||
<div id="iredmail-status" class="stat-card" style="margin-bottom:1rem;padding:0.75rem 1rem;font-size:0.9rem;">
|
||||
@@ -1601,34 +1600,6 @@
|
||||
</div>
|
||||
|
||||
<!-- Modaalit: iRedMail -->
|
||||
<div class="modal" id="iredmail-config-modal" style="display:none;">
|
||||
<div class="modal-content" style="max-width:500px;">
|
||||
<div class="modal-header">
|
||||
<h3>iRedMail-asetukset</h3>
|
||||
<button class="modal-close" onclick="document.getElementById('iredmail-config-modal').style.display='none'">×</button>
|
||||
</div>
|
||||
<div class="form-grid" style="max-width:100%;">
|
||||
<div class="form-group full-width">
|
||||
<label>API URL</label>
|
||||
<input type="text" id="iredmail-cfg-url" placeholder="https://mail.example.com/iredadmin">
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label>Admin-sähköposti</label>
|
||||
<input type="text" id="iredmail-cfg-email" placeholder="postmaster@example.com">
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label>Salasana</label>
|
||||
<input type="password" id="iredmail-cfg-password" placeholder="Jätä tyhjäksi jos ei muuteta">
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex;gap:0.5rem;margin-top:1rem;">
|
||||
<button class="btn-primary" id="btn-iredmail-cfg-save">Tallenna</button>
|
||||
<button class="btn-secondary" id="btn-iredmail-cfg-test">Testaa yhteyttä</button>
|
||||
</div>
|
||||
<div id="iredmail-cfg-status" style="margin-top:0.5rem;font-size:0.85rem;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="iredmail-domain-modal" style="display:none;">
|
||||
<div class="modal-content" style="max-width:450px;">
|
||||
<div class="modal-header">
|
||||
@@ -1866,6 +1837,38 @@
|
||||
<div id="company-zammad-result" style="margin-top:0.75rem;display:none;padding:0.75rem;border-radius:8px;font-size:0.85rem;"></div>
|
||||
</div>
|
||||
|
||||
<div class="table-card" id="settings-iredmail-card" style="padding:1.5rem;margin-top:1rem;display:none;">
|
||||
<h3 style="color:#0f3460;margin-bottom:0.5rem;border-bottom:2px solid #f0f2f5;padding-bottom:0.5rem;">📮 iRedMail (Sähköposti)</h3>
|
||||
<p style="color:#666;font-size:0.85rem;margin-bottom:1rem;">Yhdistä iRedMail-sähköpostipalvelimen tietokantaan (vmail). Hallinta-moduulissa voit hallita domaineja, tilejä ja aliaksia.</p>
|
||||
<div class="form-grid" style="max-width:500px;">
|
||||
<div class="form-group full-width">
|
||||
<label>Tietokantapalvelin (host)</label>
|
||||
<input type="text" id="company-iredmail-host" placeholder="mail.example.com" style="font-family:monospace;">
|
||||
</div>
|
||||
<div class="form-group" style="flex:1;">
|
||||
<label>Tietokanta</label>
|
||||
<input type="text" id="company-iredmail-dbname" value="vmail" placeholder="vmail" style="font-family:monospace;">
|
||||
</div>
|
||||
<div class="form-group" style="flex:0 0 100px;">
|
||||
<label>Portti</label>
|
||||
<input type="number" id="company-iredmail-port" value="3306" min="1" max="65535" style="font-family:monospace;">
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label>Käyttäjä</label>
|
||||
<input type="text" id="company-iredmail-user" placeholder="vmailadmin" style="font-family:monospace;">
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label>Salasana</label>
|
||||
<input type="password" id="company-iredmail-password" placeholder="Salasana">
|
||||
</div>
|
||||
<div class="form-group full-width" style="display:flex;gap:0.5rem;flex-wrap:wrap;">
|
||||
<button type="button" class="btn-primary" id="btn-company-iredmail-save">Tallenna</button>
|
||||
<button type="button" class="btn-secondary" id="btn-company-iredmail-test">Testaa yhteys</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="company-iredmail-result" style="margin-top:0.75rem;display:none;padding:0.75rem;border-radius:8px;font-size:0.85rem;"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2001,6 +2004,9 @@
|
||||
<label style="display:flex;align-items:center;gap:0.5rem;font-size:0.9rem;cursor:pointer;">
|
||||
<input type="checkbox" data-integration="telegram"> 🤖 Telegram-hälytykset
|
||||
</label>
|
||||
<label style="display:flex;align-items:center;gap:0.5rem;font-size:0.9rem;cursor:pointer;">
|
||||
<input type="checkbox" data-integration="iredmail"> 📮 iRedMail (Sähköposti)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Postilaatikot -->
|
||||
|
||||
Reference in New Issue
Block a user