0.12.2 registration mail

This commit is contained in:
SDE
2024-01-31 16:39:03 +03:00
parent 60636daeb8
commit 406b5e8480
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'])
}