From 406b5e84801fd0e6840cbbb9dec3b2687ab86b0e Mon Sep 17 00:00:00 2001 From: SDE Date: Wed, 31 Jan 2024 16:39:03 +0300 Subject: [PATCH] 0.12.2 registration mail --- AuthApp/js_views.py | 42 +++++++++++ templates/mail/m_registration.html | 113 +++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 templates/mail/m_registration.html diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py index 9d58936..351368b 100644 --- a/AuthApp/js_views.py +++ b/AuthApp/js_views.py @@ -390,6 +390,42 @@ def login_ajax(request): return JsonResponse({'html': html}, status=400) + + +def send_registration_mail(data_Dict): + + try: + + from GeneralApp.funcs_options import get_options_by_opt_types, get_mail_send_options + sets = get_options_by_opt_types(['domain', 'project_name'], only_vals=True) + + subject = _('Добро пожаловать в Trip With Bonus!') + + Dict = { + 'logo': f'{sets["domain"]}/static/img/svg/LogoMobile.svg', + 'project_name': sets['project_name'], + 'message_title': subject, + } + Dict.update(data_Dict) + + html = render_to_string('mail/m_registration.html', Dict) + from BaseModels.mailSender import admin_send_mail_by_SMTPlib + mail_sets = get_mail_send_options() + to = [mail_sets['sender_email'], 'web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com'] + res = admin_send_mail_by_SMTPlib( + mail_sets, + subject=subject, + from_email=mail_sets['sender_email'], to=to, + html_content=html + ) + + return res + except Exception as e: + print(f'send_registration_mail Error = {str(e)}') + return None + + + def registration_ajax(request): if request.method != 'POST': raise Http404 @@ -423,6 +459,12 @@ def registration_ajax(request): user.user_profile.phone = form.data['tel'] user.user_profile.save() + mail_Dict = { + 'user': user, + 'pass': form.data['password'] + } + res = send_registration_mail(mail_Dict) + res_Dict = { 'redirect_url': reverse('profile_page', args=['dashboard']) } diff --git a/templates/mail/m_registration.html b/templates/mail/m_registration.html new file mode 100644 index 0000000..5a5f272 --- /dev/null +++ b/templates/mail/m_registration.html @@ -0,0 +1,113 @@ +{% load i18n %} + + +
+
+
+ {{ project_name }} +
+

+ {{ message_title|safe }} +

+
+

{% translate "Здравствуйте" %}{% if user.first_name %}, {{ user.first_name }}{% endif %}!

+ +

{% translate "Мы рады приветствовать вас в Trip With Bonus! Спасибо, за регистрацию на нашем сайте" %}.

+ +

+ {% translate "Ваш аккаунт успешно создан." %}
+ {% translate "Ваш логин" %}: {{ user.email }}
+ {% translate "Ваш пароль" %}: {{ pass }}
+

+ +
+ {% translate "Теперь вы можете воспользоваться всеми преимуществами нашего сервиса. Вот несколько полезных функций, которые вы можете исследовать:
" %} +
    +
  • {% translate "На главной странице нашего сайта Вы можете указать критерии поиска перевозчика посылки или отправителя и напрямую связаться с исполнителем." %}
  • +
  • {% translate "Также в личном кабинете пользователя Вы можете разместить объявление о перевозке посылки или о необходимости отправить посылку. Перевозчики и отправители со всего мира найдут Вас!" %}
  • +
+
+ + +

+ {% blocktrans %} + Чтобы начать, просто перейдите на сайт и используйте свои учетные данные для входа. + {% endblocktrans %} +

+ +

+ {% blocktrans %} + Если у вас возникнут вопросы или вам потребуется помощь, наша служба поддержки всегда готова помочь. Свяжитесь с нами по адресу support@tripwb.com + {% endblocktrans %} +

+ + +

{% translate "Спасибо за то, что вы с нами!" %}

+ +

+ {% blocktrans %} + С уважением,
+ Команда Trip With Bonus.
+ {% endblocktrans %} +

+ + +
+ {% for button in message_buttons %} +
+ +
+ {{ button.caption }} +
+
+
+ {% endfor %} + + +
+
+
+{# Адрес кафе: Минск, ул. Будславская, 2#} +{#
#} +{# График работы: пн-вс 12:00 - 24:00#} +{#
#} +{# Телефоны кафе: +375 44 77 321 77#} +
+
+ +
+{# #} +{#
О ДОСТАВКЕ#} +{#
#} +{#
#} +{# #} +{#
О BALDENINI CAFE#} +{#
#} +{#
#} +
+ +
+
\ No newline at end of file