update
This commit is contained in:
90
templates/admin/reports/sitesettings/change_form.html
Normal file
90
templates/admin/reports/sitesettings/change_form.html
Normal file
@@ -0,0 +1,90 @@
|
||||
{% extends "admin/change_form.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block submit_buttons_bottom %}
|
||||
{{ block.super }}
|
||||
|
||||
{% if show_test_email %}
|
||||
<div style="margin-top: 20px; padding: 15px; background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px;">
|
||||
<h3 style="margin-top: 0;">Тест на Имейл Сървър</h3>
|
||||
<p>Изпратете тестов имейл, за да проверите дали настройките на имейл сървъра са правилни.</p>
|
||||
<form method="post" style="display: flex; gap: 10px; align-items: flex-end;">
|
||||
{% csrf_token %}
|
||||
<div style="flex: 1;">
|
||||
<label for="test_email_address" style="display: block; margin-bottom: 5px; font-weight: 600;">Имейл адрес за тест:</label>
|
||||
<input type="email"
|
||||
id="test_email_address"
|
||||
name="test_email_address"
|
||||
value="{{ user.email }}"
|
||||
class="vTextField"
|
||||
style="width: 100%; padding: 8px;"
|
||||
placeholder="test@example.com"
|
||||
required>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit"
|
||||
name="_test_email"
|
||||
class="default"
|
||||
style="padding: 10px 20px; background: #417690; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
||||
📧 Изпрати Тестов Имейл
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<p style="margin-top: 10px; font-size: 12px; color: #666;">
|
||||
<strong>Забележка:</strong> Уверете се, че сте запазили промените преди изпращане на тестов имейл.
|
||||
</p>
|
||||
{% if original.email_backend == 'django.core.mail.backends.smtp.EmailBackend' and not original.email_host %}
|
||||
<div style="margin-top: 15px; padding: 12px; background: #fff3cd; border: 1px solid #ffc107; border-radius: 4px;">
|
||||
<strong style="color: #856404;">⚠️ Внимание:</strong>
|
||||
<p style="margin: 5px 0 0 0; color: #856404;">
|
||||
SMTP сървърът не е конфигуриран. Моля, попълнете полето "Email Host" и запазете настройките преди изпращане на тестов имейл.
|
||||
Без конфигуриран SMTP сървър, имейлите ще се изпращат само в конзолата (за разработка).
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if original.email_use_tls and original.email_use_ssl %}
|
||||
<div style="margin-top: 15px; padding: 12px; background: #f8d7da; border: 1px solid #dc3545; border-radius: 4px;">
|
||||
<strong style="color: #721c24;">❌ Грешка:</strong>
|
||||
<p style="margin: 5px 0 0 0; color: #721c24;">
|
||||
TLS и SSL не могат да бъдат активирани едновременно! Моля, изберете само едно от двете.
|
||||
Обикновено използвайте TLS за порт 587 или SSL за порт 465.
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block admin_change_form_document_ready %}
|
||||
{{ block.super }}
|
||||
<script>
|
||||
(function($) {
|
||||
// Make TLS and SSL mutually exclusive
|
||||
var tlsField = $('#id_email_use_tls');
|
||||
var sslField = $('#id_email_use_ssl');
|
||||
|
||||
function updateMutualExclusivity() {
|
||||
if (tlsField.is(':checked') && sslField.is(':checked')) {
|
||||
// If both are checked, uncheck SSL (TLS is more common)
|
||||
sslField.prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
tlsField.on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
sslField.prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
sslField.on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
tlsField.prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
// Check on page load
|
||||
updateMutualExclusivity();
|
||||
})(django.jQuery);
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user