Merge remote-tracking branch 'origin/main'

This commit is contained in:
SBD
2024-01-31 16:57:06 +03:00
2 changed files with 155 additions and 0 deletions

View File

@@ -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'])
}

View File

@@ -0,0 +1,113 @@
{% load i18n %}
<div style="font-family:Calibri,Candara,Segoe,'Segoe UI',Optima,Arial,sans-serif;
padding:10px; background-color: #F8F8F8;"
>
<div style="line-height:1.0em; width: 660px">
<div style="padding:5px; text-align: center;">
<img src="{{ logo }}" alt="{{ project_name }}" style="margin:0;padding:0;">
</div>
<p style="font-weight:700; font-size:25px; text-align:center;
padding:0; line-height:1em; text-transform: uppercase; color: #ff613a;
margin: auto; max-width: 90%;
">
{{ message_title|safe }}
</p>
<div style="line-height:1.0em; font-size:18px; margin: 5px 30px;
box-shadow: -1px 4px 10px 0 rgba(198, 199, 203, 0.20), 0 -1px 10px 0 rgba(198, 199, 203, 0.20);
padding: 30px; border-radius: 10px; background-color: #FFF;">
<p style="font-weight: 600;">{% translate "Здравствуйте" %}{% if user.first_name %}, {{ user.first_name }}{% endif %}!</p>
<p>{% translate "Мы рады приветствовать вас в Trip With Bonus! Спасибо, за регистрацию на нашем сайте" %}.</p>
<p>
{% translate "Ваш аккаунт успешно создан." %}<br>
{% translate "Ваш логин" %}: <b>{{ user.email }}</b><br>
{% translate "Ваш пароль" %}: <b>{{ pass }}</b><br>
</p>
<div>
{% translate "Теперь вы можете воспользоваться всеми преимуществами нашего сервиса. Вот несколько полезных функций, которые вы можете исследовать:<br>" %}
<ul>
<li>{% translate "На главной странице нашего сайта Вы можете указать критерии поиска перевозчика посылки или отправителя и напрямую связаться с исполнителем." %}</li>
<li>{% translate "Также в личном кабинете пользователя Вы можете разместить объявление о перевозке посылки или о необходимости отправить посылку. Перевозчики и отправители со всего мира найдут Вас!" %}</li>
</ul>
</div>
<p>
{% blocktrans %}
Чтобы начать, просто перейдите на <a href="https://tripwb.com">сайт</a> и используйте свои учетные данные для входа.
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
Если у вас возникнут вопросы или вам потребуется помощь, наша служба поддержки всегда готова помочь. Свяжитесь с нами по адресу <a href="mailto:support@tripwb.com">support@tripwb.com</a>
{% endblocktrans %}
</p>
<p>{% translate "Спасибо за то, что вы с нами!" %}</p>
<p>
{% blocktrans %}
С уважением,<br>
Команда Trip With Bonus.<br>
{% endblocktrans %}
</p>
</div>
{% for button in message_buttons %}
<div style="text-align:center;font-weight: 700;">
<a href="{{ button.url }}">
<div style="display:inline-block;text-align:center;font-size:18px;padding:5px 10px;margin:5px;border-radius:2px;background-color:#61aeb6;color:#fff;text-decoration:none;line-height:1.0em;cursor:pointer">
{{ button.caption }}
</div>
</a>
</div>
{% endfor %}
<div style="text-align:center;width: 660px;line-height:1.1em">
<div style="margin: 40px 10px 10px;">
<hr>
{# <nobr><b>Адрес кафе:</b> Минск, ул. Будславская, 2</nobr>#}
{# <br>#}
{# <nobr><b>График работы:</b> пн-вс 12:00 - 24:00</nobr>#}
{# <br>#}
{# <nobr><b>Телефоны кафе:</b> +375 44 77 321 77</nobr>#}
</div>
</div>
<div style="text-align: center;margin-top:5px">
{# <a href="https://baldenini.by/event/dostavka-edy" style="text-decoration: none;">#}
{# <div style="color: #311A12;#}
{# padding: 10px;#}
{# margin: 5px 10px 0 10px;#}
{# border: 2px solid #311A12;#}
{# border-radius: 5px;#}
{# font-size: 20px;#}
{# display: inline-block;#}
{# font-weight: 700;#}
{# text-transform: uppercase;">О ДОСТАВКЕ#}
{# </div>#}
{# </a>#}
{# <a href="https://baldenini.by/page/baldenini-cafe-o-nas" style="text-decoration: none;">#}
{# <div style="color: #311A12;#}
{# padding: 10px;#}
{# margin: 5px 10px 0 10px;#}
{# border: 2px solid #311A12;#}
{# border-radius: 5px;#}
{# font-size: 20px;#}
{# display: inline-block;#}
{# font-weight: 700;#}
{# text-transform: uppercase;">О BALDENINI CAFE#}
{# </div>#}
{# </a>#}
</div>
</div>
</div>