diff --git a/common/djangoapps/student/tests/test_verification_status.py b/common/djangoapps/student/tests/test_verification_status.py index 9c2f0f66b8..1fa20feb63 100644 --- a/common/djangoapps/student/tests/test_verification_status.py +++ b/common/djangoapps/student/tests/test_verification_status.py @@ -9,6 +9,8 @@ import six from django.conf import settings from django.test import override_settings from django.urls import reverse +from django.utils.timezone import now + from mock import patch from pytz import UTC @@ -131,6 +133,17 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase): response = self.client.get(self.dashboard_url) self.assertContains(response, attempt.expiration_datetime.strftime("%m/%d/%Y")) + @patch("lms.djangoapps.verify_student.services.is_verification_expiring_soon") + def test_verify_resubmit_button_on_dashboard(self, mock_expiry): + mock_expiry.return_value = True + SoftwareSecurePhotoVerification.objects.create(user=self.user, status='approved', expiry_date=now()) + response = self.client.get(self.dashboard_url) + self.assertContains(response, "Resubmit Verification") + + mock_expiry.return_value = False + response = self.client.get(self.dashboard_url) + self.assertNotContains(response, "Resubmit Verification") + def test_missed_verification_deadline(self): # Expiration date in the past self._setup_mode_and_enrollment(self.DATES[self.PAST], "verified") @@ -299,7 +312,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase): self._assert_course_verification_status(VERIFY_STATUS_APPROVED) response2 = self.client.get(self.dashboard_url) self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y")) - self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y"), count=3) + self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y"), count=2) def _setup_mode_and_enrollment(self, deadline, enrollment_mode): """Create a course mode and enrollment. diff --git a/lms/djangoapps/verify_student/services.py b/lms/djangoapps/verify_student/services.py index e79fc86a18..795904c8f1 100644 --- a/lms/djangoapps/verify_student/services.py +++ b/lms/djangoapps/verify_student/services.py @@ -12,6 +12,7 @@ from django.urls import reverse from django.utils.translation import ugettext as _ from course_modes.models import CourseMode +from lms.djangoapps.verify_student.utils import is_verification_expiring_soon from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from student.models import User @@ -213,7 +214,8 @@ class IDVerificationService(object): elif attempt.status == 'approved': user_status['status'] = 'approved' - if getattr(attempt, 'expiry_date', None): + expiration_datetime = cls.get_expiration_datetime(user, ['approved']) + if getattr(attempt, 'expiry_date', None) and is_verification_expiring_soon(expiration_datetime): user_status['verification_expiry'] = attempt.expiry_date.date().strftime("%m/%d/%Y") elif attempt.status in ['submitted', 'approved', 'must_retry']: diff --git a/lms/static/sass/multicourse/_dashboard.scss b/lms/static/sass/multicourse/_dashboard.scss index e3522dc18f..0256f717a9 100644 --- a/lms/static/sass/multicourse/_dashboard.scss +++ b/lms/static/sass/multicourse/_dashboard.scss @@ -1250,6 +1250,18 @@ border-bottom-color: $verified-color-lvl4; } + .action-reverify { + @extend %btn-primary-error; + @extend %t-weight4; + + display: block; + + @include font-size(14); + } + + .btn-reverify { + margin-top: ($baseline/2); + } .deco-arrow { @include triangle(($baseline/2), $verified-color-lvl4, up); } diff --git a/lms/templates/dashboard/_dashboard_status_verification.html b/lms/templates/dashboard/_dashboard_status_verification.html index 30cb78df13..ca992ccac4 100644 --- a/lms/templates/dashboard/_dashboard_status_verification.html +++ b/lms/templates/dashboard/_dashboard_status_verification.html @@ -11,7 +11,10 @@ from django.utils.translation import ugettext as _ ${_("Current Verification Status: Approved")}
${_("Your edX verification has been approved. Your verification is effective for one year after submission.")}
%if verification_expiry: -${_("Warning")}: ${_("Your photo verification expires on {verification_expiry}.Approved verification photos are required to earn a certificate and to take a proctored exam. It can take up to 3 days to re-verify, so please re-verify at least a week before any proctored events.").format(verification_expiry=verification_expiry)}
+${_("Warning")}: ${_("Your photo verification expires on {verification_expiry}. Please be aware photo verification can take up to three days once initiated and you will not be able to earn a certificate or take a proctored exam until approved.").format(verification_expiry=verification_expiry)}
+ %endif %elif verification_status == 'pending': @@ -43,7 +46,7 @@ from django.utils.translation import ugettext as _${_("Your verification has expired. To receive a verified certificate, you must submit a new photo of yourself and your government-issued photo ID before the verification deadline for your course.")}
-${_("Warning")}: ${_("Approved verification photos are required to earn a certificate and to take a proctored exam. It can take up to 3 days to re-verify, so please re-verify at least a week before any proctored events.")}
+${_("Warning")}: ${_(" Please be aware photo verification can take up to three days once initiated and you will not be able to earn a certificate or take a proctored exam until approved.")}