diff --git a/form/index.html b/form/index.html index e0b76cd..dfcba21 100644 --- a/form/index.html +++ b/form/index.html @@ -151,13 +151,13 @@
-

Заявка отправлена!

+

Оплата прошла успешно!

- Спасибо за ваше обращение!
+ Спасибо за оплату!
Наш киберспортивный координатор свяжется с вами в ближайшее время, чтобы открыть доступ к тестовым - материалам и записать на бесплатный урок. + материалам и записать на занятие.

- + diff --git a/form/script.js b/form/script.js index 9625892..8c54c1a 100644 --- a/form/script.js +++ b/form/script.js @@ -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); }); }); diff --git a/server.py b/server.py index a4f96cc..22b00d8 100644 --- a/server.py +++ b/server.py @@ -452,11 +452,12 @@ def send_email_notification(reg_id, data, paid=False): """ + 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: @@ -464,15 +465,20 @@ def send_email_notification(reg_id, data, paid=False): else: server = smtplib.SMTP(smtp_server, smtp_port) 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