4.5. Specifying Allowed Registration Email Patterns

This topic describes how to restrict registration on your site by specifying which email address patterns are allowed in registration emails.

4.5.1. Overview

By default, all email addresses are accepted when learners register for an account on your Open edX site. You have the option of restricting registrations to learners who use an allowed email address pattern. Doing so can be useful in cases where you want to allow only learners who are members of a school, organization, or corporation to register and access your courses.

Note

Configuring your site using the procedure below only restricts registration to learners whose email addresses match the specified patterns. It does not hide courses from any learners, or prevent access to pages on your site that can be accessed without registration.

4.5.2. Configure Allowed Email Patterns

To specify the email patterns that are allowed for registration, follow these steps.

  1. Locate the lms.yml and studio.yml files, which are located one level above the edx-platform directory. You make the same changes to both files.

  2. In the lms.yml and studio.yml files add the REGISTRATION_EMAIL_PATTERNS_ALLOWED setting.

    "REGISTRATION_EMAIL_PATTERNS_ALLOWED": null
    

    If the value for this setting is null, there are no restrictions, and all email addresses are accepted for registration.

  3. Use one or more Python regular expressions to specify the email domains that allowed email addresses must match.

    The following example allows email addresses using the pattern example.com or any.example.com to register. It also allows school.tld addresses, but only if those addresses have a . before the @ symbol.

    "REGISTRATION_EMAIL_PATTERNS_ALLOWED" = [
    
       "^.*@(.*\\.)?example\\.com$",
       "(^\\w+\\.\\w+)@school\\.tld$"
    ]
    
  4. Save the lms.yml and studio.yml files.

  5. Restart your edxapp instances.