From a76be3052276945d688ab8746679f25cd40cad3f Mon Sep 17 00:00:00 2001 From: adityacp Date: Wed, 3 May 2017 16:10:28 +0530 Subject: Change forms.py, views.py and urls.py - Store activation key expiry time according to timezone for email verification and activation - Add reverse resolution in urls.py --- yaksh/views.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'yaksh/views.py') diff --git a/yaksh/views.py b/yaksh/views.py index 6a4325e..c7af5cc 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -42,7 +42,7 @@ from yaksh.forms import UserRegisterForm, UserLoginForm, QuizForm,\ from .settings import URL_ROOT from yaksh.models import AssignmentUpload from .file_utils import extract_files -from .email_verification import send_user_mail, generate_activation_key +from .send_emails import send_user_mail, generate_activation_key from .decorators import email_verified @@ -1540,10 +1540,8 @@ def new_activation(request, email=None): if not user.profile.is_email_verified: user.profile.activation_key = generate_activation_key(user.username) - user.profile.key_expiry_time = datetime.strftime( - datetime.now() + \ - timedelta(minutes=20), "%Y-%m-%d %H:%M:%S" - ) + user.profile.key_expiry_time = timezone.now() + \ + timezone.timedelta(minutes=20) user.profile.save() success, msg = send_user_mail(user.email, user.profile.activation_key) if success: @@ -1599,6 +1597,7 @@ def download_assignment_file(request, quiz_id, question_id=None, user_id=None): return response @login_required +@email_verified def duplicate_course(request, course_id): user = request.user course = get_object_or_404(Course, pk=course_id) -- cgit