1.2.0 confirm email after registration
This commit is contained in:
@@ -466,24 +466,24 @@ def login_ajax(request):
|
||||
|
||||
|
||||
|
||||
|
||||
def send_registration_mail(data_Dict, user):
|
||||
def send_check_email_after_registration(data_Dict, user):
|
||||
|
||||
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!')
|
||||
subject = _('Trip With Bonus - Подтверждение регистрации ')
|
||||
|
||||
Dict = {
|
||||
'logo': f'{sets["domain"]}/static/img/svg/LogoMobile.svg',
|
||||
'project_name': sets['project_name'],
|
||||
'domain': sets['domain'],
|
||||
'message_title': subject,
|
||||
}
|
||||
Dict.update(data_Dict)
|
||||
|
||||
html = render_to_string('mail/m_registration.html', Dict)
|
||||
html = render_to_string('mail/m_confirm_email.html', Dict)
|
||||
from BaseModels.mailSender import admin_send_mail_by_SMTPlib
|
||||
mail_sets = get_mail_send_options()
|
||||
to = [user.email, 'web@syncsystems.net', 'sa@a3-global.com', 'sysadmin.hax@gmail.com']
|
||||
@@ -501,6 +501,9 @@ def send_registration_mail(data_Dict, user):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def registration_ajax(request):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
@@ -528,26 +531,29 @@ def registration_ajax(request):
|
||||
|
||||
user = User.objects.create_user(username=form.data['email'], email=form.data['email'], password=form.data['password'])
|
||||
# user = auth.authenticate(username=new_user_Dict['name'], password=new_user_Dict['pass'])
|
||||
if user:
|
||||
auth.login(request, user, backend='django.contrib.auth.backends.ModelBackend')
|
||||
# if user:
|
||||
# auth.login(request, user, backend='django.contrib.auth.backends.ModelBackend')
|
||||
|
||||
if 'mailingSubscribeRequired' in data and data['mailingSubscribeRequired'] == 'true':
|
||||
user.user_profile.mailing_on = True
|
||||
|
||||
user.last_name = form.data['lastname']
|
||||
user.first_name = form.data['firstname']
|
||||
user.is_active = False
|
||||
user.save()
|
||||
user.user_profile.phone = form.data['tel']
|
||||
user.user_profile.authMailCode = uuid1().hex
|
||||
user.user_profile.save()
|
||||
|
||||
mail_Dict = {
|
||||
'user': user,
|
||||
'pass': form.data['password']
|
||||
}
|
||||
res = send_registration_mail(mail_Dict, user)
|
||||
|
||||
res = send_check_email_after_registration(mail_Dict, user)
|
||||
# res = send_registration_mail(mail_Dict, user)
|
||||
|
||||
res_Dict = {
|
||||
'redirect_url': reverse('profile_page', args=['dashboard'])
|
||||
# 'redirect_url': reverse('profile_page', args=['dashboard'])
|
||||
}
|
||||
|
||||
return JsonResponse(res_Dict)
|
||||
|
||||
Reference in New Issue
Block a user