Skip to content

Commit

Permalink
feat: make user active in case of drupal
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Faraz Maqsood committed Mar 7, 2024
1 parent 10b5e17 commit d820896
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions common/djangoapps/student/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def process_survey_link(survey_link, user):
return survey_link.format(UNIQUE_ID=unique_id_for_user(user))


def do_create_account(form, custom_form=None):
def do_create_account(form, custom_form=None, is_active=False):
"""
Given cleaned post variables, create the User and UserProfile objects, as well as the
registration for this user.
Expand Down Expand Up @@ -700,7 +700,7 @@ def do_create_account(form, custom_form=None):
user = User(
username=proposed_username,
email=form.cleaned_data["email"],
is_active=False
is_active=is_active
)
password = normalize_password(form.cleaned_data["password"])
user.set_password(password)
Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/user_authn/views/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ def create_account_with_params(request, params): # pylint: disable=too-many-sta
)
custom_form = get_registration_extension_form(data=params)
is_marketable = params.get('marketing_emails_opt_in') in ['true', '1']

is_drupal = True if request.GET.get('is_drupal') else False
# Perform operations within a transaction that are critical to account creation
with outer_atomic():
# first, create the account
(user, profile, registration) = do_create_account(form, custom_form)
(user, profile, registration) = do_create_account(form, custom_form, is_drupal)

third_party_provider, running_pipeline = _link_user_to_third_party_provider(
is_third_party_auth_enabled, third_party_auth_credentials_in_api, user, request, params,
Expand Down

0 comments on commit d820896

Please sign in to comment.