Skip to content
This repository was archived by the owner on Nov 12, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion common/djangoapps/third_party_auth/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
a) loads this module.
b) calls apply_settings(), passing in the Django settings
"""

from django.conf import settings
from openedx.features.enterprise_support.api import insert_enterprise_pipeline_elements

_FIELDS_STORED_IN_SESSION = ['auth_entry', 'next']
Expand Down Expand Up @@ -41,6 +41,9 @@ def apply_settings(django_settings):
# Adding extra key value pair in the url query string for microsoft as per request
django_settings.SOCIAL_AUTH_AZUREAD_OAUTH2_AUTH_EXTRA_ARGUMENTS = _SOCIAL_AUTH_AZUREAD_OAUTH2_AUTH_EXTRA_ARGUMENTS

# Avoid default username check to allow non-ascii characters
django_settings.SOCIAL_AUTH_CLEAN_USERNAMES = not settings.FEATURES.get("ENABLE_UNICODE_USERNAME")

# Inject our customized auth pipeline. All auth backends must work with
# this pipeline.
django_settings.SOCIAL_AUTH_PIPELINE = [
Expand Down
6 changes: 6 additions & 0 deletions common/djangoapps/third_party_auth/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ def test_apply_settings_turns_off_raising_social_exceptions(self):
# bad in prod.
settings.apply_settings(self.settings)
self.assertFalse(self.settings.SOCIAL_AUTH_RAISE_EXCEPTIONS)

def test_apply_settings_avoids_default_username_check(self):
# Avoid the default username check where non-ascii characters are not
# allowed
settings.apply_settings(self.settings)
self.assertFalse(self.settings.SOCIAL_AUTH_CLEAN_USERNAMES)