fix: кнопка на главную после оплаты + исправление отправки SMTP письма
This commit is contained in:
+4
-4
@@ -151,13 +151,13 @@
|
||||
<div class="success-icon-wrapper">
|
||||
<div class="success-icon">✓</div>
|
||||
</div>
|
||||
<h2 class="success-title">Заявка отправлена!</h2>
|
||||
<h2 class="success-title">Оплата прошла успешно!</h2>
|
||||
<p class="success-text">
|
||||
Спасибо за ваше обращение!<br>
|
||||
Спасибо за оплату!<br>
|
||||
Наш киберспортивный координатор свяжется с вами в ближайшее время, чтобы открыть доступ к тестовым
|
||||
материалам и записать на бесплатный урок.
|
||||
материалам и записать на занятие.
|
||||
</p>
|
||||
<button id="resetBtn" class="reset-btn">Вернуться к форме</button>
|
||||
<button id="resetBtn" class="reset-btn">На главную</button>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
+3
-19
@@ -353,32 +353,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
|
||||
/* ====================================================
|
||||
Reset / Back to Form Handler
|
||||
"На главную" Button Handler
|
||||
==================================================== */
|
||||
resetBtn.addEventListener('click', () => {
|
||||
successContainer.style.transition = 'opacity 0.3s ease, transform 0.3s ease';
|
||||
successContainer.style.opacity = '0';
|
||||
successContainer.style.transform = 'translateY(10px)';
|
||||
|
||||
// Remove parameters from URL to prevent showing success container on reload
|
||||
const newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + "?service_id=" + serviceIdInput.value;
|
||||
window.history.replaceState({ path: newUrl }, '', newUrl);
|
||||
|
||||
setTimeout(() => {
|
||||
successContainer.style.display = 'none';
|
||||
formContainer.style.display = 'block';
|
||||
formContainer.style.opacity = '0';
|
||||
formContainer.style.transform = 'translateY(-10px)';
|
||||
|
||||
formContainer.offsetHeight;
|
||||
|
||||
formContainer.style.transition = 'opacity 0.4s ease, transform 0.4s ease';
|
||||
formContainer.style.opacity = '1';
|
||||
formContainer.style.transform = 'translateY(0)';
|
||||
|
||||
if (serviceIdInput.value && services[serviceIdInput.value]) {
|
||||
serviceDisplay.style.display = 'block';
|
||||
}
|
||||
// Редиректим на главную страницу сайта
|
||||
window.location.href = '/';
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -452,11 +452,12 @@ def send_email_notification(reg_id, data, paid=False):
|
||||
</html>
|
||||
"""
|
||||
|
||||
server = None
|
||||
try:
|
||||
msg = MIMEMultipart('alternative')
|
||||
msg['Subject'] = subject
|
||||
msg['From'] = smtp_from
|
||||
msg['To'] = smtp_to
|
||||
msg['To'] = ', '.join(smtp_to) # заголовок — строка
|
||||
msg.attach(MIMEText(html_content, 'html', 'utf-8'))
|
||||
|
||||
if smtp_port == 465:
|
||||
@@ -466,13 +467,18 @@ def send_email_notification(reg_id, data, paid=False):
|
||||
server.starttls()
|
||||
|
||||
server.login(smtp_user, smtp_password)
|
||||
server.sendmail(smtp_from, [smtp_to], msg.as_string())
|
||||
server.quit()
|
||||
server.sendmail(smtp_from, smtp_to, msg.as_string()) # smtp_to — список
|
||||
print(f"[SMTP] Письмо о заказе {reg_id} отправлено на {smtp_to}")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"[SMTP] Ошибка отправки письма: {e}")
|
||||
return False
|
||||
finally:
|
||||
if server:
|
||||
try:
|
||||
server.quit()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ====================================================
|
||||
# Flask Web App Routes
|
||||
|
||||
Reference in New Issue
Block a user