[BB-1504] Fix the automatic enrollment issue for inactive user

Description

When a user registers an account and then is enrolled in a course by the instructor before completing the email validation, the course shows up in the dashboard of the unverified, logged-in user. This contrasts with the behavior observed when the user is enrolled before the account is created - the user is unable to see the enrolled course before verifying the email address.

This PR adds a check for the email validation before enrolling the user.

*JIRA tickets*: None
*Dependencies*: None
*Sandbox URL*: TBD - sandbox is being provisioned.
*Merge deadline*: None

*Testing instructions*:
1. Register and create a new account in the LMS. Do not verify the email address.
1. Stay logged in as that user.
1. Enroll the user created in the previous step, in a course via the Instructor dashboard in a separate, isolated browser session.
1. Refresh the dashboard of the logged-in user with unverified email address. Without the fix, the enrolled course shows up in the user's dashboard . With the fix, the course shows up in the unverified user's dashboard only after the email verification is done.

While the unverified user can still navigate to the public courses and enroll, this issue breaks the expected behaviour with invitation-only (and optionally, private) courses.

*Reviewers*

  • [ ] @Agrendalath

  • [ ] edX reviewer[s] TBD

Status

Assignee

David Ormsbee

Reporter

Open Source Pull Request Bot

Labels

Contributor Name

Guruprasad Lakshmi Narayanan

Repo

edx/edx-platform

Customer

Epic Link

None

OSCM Assignee

None

Priority

Unset
Configure