Skip to content

Commit

Permalink
restrict duplicate enrollment only if user is verified (#2199)
Browse files Browse the repository at this point in the history
* restrict duplicate enrollment only if user is verified

* more

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
annagav and pre-commit-ci[bot] authored May 10, 2024
1 parent 8c29267 commit c9f943b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion courses/views/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
sync_enrollments_with_edx,
unsubscribe_from_edx_course_emails,
)
from openedx.constants import EDX_ENROLLMENT_VERIFIED_MODE
from openedx.exceptions import (
EdxApiEmailSettingsErrorException,
NoEdxApiAuthError,
Expand Down Expand Up @@ -252,7 +253,10 @@ def _validate_enrollment_post_request(
if (
PaidCourseRun.fulfilled_paid_course_run_exists(user, run)
or CourseRunEnrollment.objects.filter(
user=user, run=run, change_status=None
user=user,
run=run,
change_status=None,
enrollment_mode=EDX_ENROLLMENT_VERIFIED_MODE,
).exists()
):
resp = redirect_with_user_message(
Expand Down

0 comments on commit c9f943b

Please sign in to comment.