|
|
|
@ -66,7 +66,7 @@ def confirmation_sent(request, *args, **kwargs):
|
|
|
|
|
context = {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return render(request, 'email-confirmation-sent.html', context)
|
|
|
|
|
return render(request, 'email_confirmation_sent.html', context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def signup(request):
|
|
|
|
@ -102,10 +102,10 @@ def signup(request):
|
|
|
|
|
message = render_to_string('email_templates/account_activation_email.html', {
|
|
|
|
|
'user': user,
|
|
|
|
|
'domain': current_site.domain,
|
|
|
|
|
'uid': urlsafe_base64_encode(force_bytes(user.pk)),
|
|
|
|
|
'uid': urlsafe_base64_encode(force_bytes(user.pk)), #Encode the user id
|
|
|
|
|
'token': token,
|
|
|
|
|
})
|
|
|
|
|
send_mail(mail_subject, message, settings.EMAIL_HOST_USER, [user.email])
|
|
|
|
|
send_mail(mail_subject, message, settings.EMAIL_HOST_USER, [user.email], html_message=message)
|
|
|
|
|
|
|
|
|
|
return redirect('activation_sent')
|
|
|
|
|
|
|
|
|
@ -126,12 +126,12 @@ def signup(request):
|
|
|
|
|
|
|
|
|
|
def activate(request, uidb64, token):
|
|
|
|
|
try:
|
|
|
|
|
uid = str(urlsafe_base64_decode(uidb64), 'utf-8')
|
|
|
|
|
user = User.objects.get(pk=uid)
|
|
|
|
|
uid = str(urlsafe_base64_decode(uidb64), 'utf-8') #Decoding the user id which was encoded in uid
|
|
|
|
|
user = User.objects.get(pk=uid) #Get the user based on uid which is now the id since it was decoded in the previous line of code
|
|
|
|
|
except (TypeError, ValueError, OverflowError, User.DoesNotExist):
|
|
|
|
|
user = None
|
|
|
|
|
|
|
|
|
|
if user is not None and default_token_generator.check_token(user, token):
|
|
|
|
|
if user is not None and default_token_generator.check_token(user, token): #Check token for further security
|
|
|
|
|
profile = CustomerProfile.objects.get(user=user)
|
|
|
|
|
profile.status = 'Active'
|
|
|
|
|
profile.save()
|
|
|
|
|