summaryrefslogtreecommitdiff
path: root/yaksh/send_emails.py
diff options
context:
space:
mode:
authoradityacp2017-05-16 17:56:40 +0530
committeradityacp2017-05-16 17:56:40 +0530
commit4c7f5e6d2b48242e8c3cc97e30df9a8506b9e333 (patch)
tree611b5bb45f675de127c9d839bc28ee25b27d042e /yaksh/send_emails.py
parent7baaa70c0e7f660ad7482c3c3950eab171b27cd3 (diff)
downloadonline_test-4c7f5e6d2b48242e8c3cc97e30df9a8506b9e333.tar.gz
online_test-4c7f5e6d2b48242e8c3cc97e30df9a8506b9e333.tar.bz2
online_test-4c7f5e6d2b48242e8c3cc97e30df9a8506b9e333.zip
Change forms.py, views.py, send_emails.py, models.py
- Alter activation_key field in Profile model - Change get_activation_key function in send_mail to create secret_key of fixed length - Change forms.py to get updated activation_key - Change views.py to save activation_key
Diffstat (limited to 'yaksh/send_emails.py')
-rw-r--r--yaksh/send_emails.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/yaksh/send_emails.py b/yaksh/send_emails.py
index 8983024..24215dd 100644
--- a/yaksh/send_emails.py
+++ b/yaksh/send_emails.py
@@ -5,7 +5,6 @@ except ImportError:
from string import ascii_letters as letters
from string import digits, punctuation
import hashlib
-from random import randint
from textwrap import dedent
import smtplib
@@ -18,7 +17,7 @@ from django.core.mail import send_mass_mail, send_mail
def generate_activation_key(username):
""" Generate hashed secret key for email activation """
chars = letters + digits + punctuation
- secret_key = get_random_string(randint(10, 40), chars)
+ secret_key = get_random_string(20, chars)
return hashlib.sha256((secret_key + username).encode('utf-8')).hexdigest()