Merge branch 'master' into private_to_public_d93abb8

This commit is contained in:
Ali-D-Akbar
2021-01-05 11:43:25 +05:00
14 changed files with 38 additions and 88 deletions

View File

@@ -9,6 +9,7 @@ from contextlib import contextmanager
import mock
from django import test
from django.conf import settings
from django.contrib import auth
from django.contrib.auth import models as auth_models
from django.contrib.messages.storage import fallback
@@ -24,6 +25,7 @@ from lms.djangoapps.commerce.tests import TEST_API_URL
from openedx.core.djangoapps.user_authn.views.login import login_user
from openedx.core.djangoapps.user_authn.views.login_form import login_and_registration_form
from openedx.core.djangoapps.user_authn.views.register import RegistrationView
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory
from openedx.core.djangoapps.user_api.accounts.settings_views import account_settings_context
from common.djangoapps.student import models as student_models
@@ -125,8 +127,14 @@ class HelperMixin(object):
"""Asserts failure on /login for inactive account looks right."""
self.assertEqual(400, response.status_code)
payload = json.loads(response.content.decode('utf-8'))
context = {
'platformName': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'supportLink': configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK)
}
self.assertFalse(payload.get('success'))
self.assertIn('inactive-user', payload.get('error_code'))
self.assertEqual(context, payload.get('context'))
def assert_json_failure_response_is_missing_social_auth(self, response):
"""Asserts failure on /login for missing social auth looks right."""

View File

@@ -175,7 +175,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
self.assertIsNone(VerificationDeadline.deadline_for_course(self.course.id))
# Generate the expected data
verification_deadline = datetime(year=2020, month=12, day=31, tzinfo=pytz.utc)
verification_deadline = datetime(year=2030, month=12, day=31, tzinfo=pytz.utc)
expiration_datetime = datetime.now(pytz.utc)
response, expected = self._get_update_response_and_expected_data(expiration_datetime, verification_deadline)

View File

@@ -59,8 +59,9 @@ var edx = edx || {};
if (chapter_location !== 'none') {
var chapter = self.find_unit(self.hidden, chapter_location);
self.sequential_select.html('')
// xss-lint: disable=javascript-jquery-append, javascript-concat-html
.append('<option value="all">' + gettext('All subsections') + '</option>')
.append(self.schedule_options(chapter.children));
.append(self.schedule_options(chapter.children)); // xss-lint: disable=javascript-jquery-append
self.sequential_select.prop('disabled', false);
$('#add-unit-button').prop('disabled', false);
// When a chapter is selected, start date fields are enabled and due date
@@ -81,8 +82,9 @@ var edx = edx || {};
var chapter = self.chapter_select.val(),
sequential = self.find_unit(self.hidden, chapter, sequential_location);
self.vertical_select.html('')
// xss-lint: disable=javascript-jquery-append, javascript-concat-html
.append('<option value="all">' + gettext('All units') + '</option>')
.append(self.schedule_options(sequential.children));
.append(self.schedule_options(sequential.children)); // xss-lint: disable=javascript-jquery-append
self.vertical_select.prop('disabled', false);
self.set_datetime('start', sequential.start);
self.set_datetime('due', sequential.due);
@@ -175,14 +177,15 @@ var edx = edx || {};
});
// schedule_template defined globally in ccx\schedule.html
/* globals schedule_template */
this.$el.html(schedule_template({chapters: this.showing}));
this.$el.html(schedule_template({chapters: this.showing})); // xss-lint: disable=javascript-jquery-html
$('table.ccx-schedule .sequential,.vertical').hide();
$('table.ccx-schedule .unit .toggle-collapse').on('click', this.toggle_collapse);
// Hidden hover fields for empty date fields
$('table.ccx-schedule .date button').each(function() {
if ($(this).text().trim() === gettext('Click to change')) {
// xss-lint: disable=javascript-jquery-html, javascript-concat-html
$(this).html('Set date <span class="sr"> ' +
gettext('Click to change') + '</span>');
gettext('Click to change') + '</span>'); // xss-lint: disable=javascript-concat-html
}
});
@@ -218,8 +221,9 @@ var edx = edx || {};
if (this.hidden.length) {
// Populate chapters select, depopulate others
this.chapter_select.html('')
// xss-lint: disable=javascript-jquery-append, javascript-concat-html
.append('<option value="none">' + gettext('Select a chapter') + '...</option>')
.append(self.schedule_options(this.hidden));
.append(self.schedule_options(this.hidden)); // xss-lint: disable=javascript-jquery-append
this.sequential_select.html('').prop('disabled', true);
this.vertical_select.html('').prop('disabled', true);
$('form#add-unit').show();

View File

@@ -114,7 +114,7 @@ var edx = edx || {};
}
// render the name of the product being paid for
$('div.payment-buttons span.product-name').append(
$('div.payment-buttons span.product-name').append( // xss-lint: disable=javascript-jquery-append
self._getProductText(templateContext.courseModeSlug, templateContext.upgrade)
);
@@ -128,6 +128,7 @@ var edx = edx || {};
} else {
// create a button for each payment processor
_.each(processors.reverse(), function(processorName) {
// xss-lint: disable=javascript-jquery-append
$('div.payment-buttons').append(self._getPaymentButtonHtml(processorName));
});
}
@@ -197,7 +198,7 @@ var edx = edx || {};
type: 'hidden',
name: key,
value: value
}).appendTo($form);
}).appendTo($form); // xss-lint: disable=javascript-jquery-insert-into-target
});
// Marketing needs a way to tell the difference between users

View File

@@ -10,18 +10,19 @@ class AuthFailedError(Exception):
message.
"""
def __init__(
self, value=None, redirect=None, redirect_url=None, error_code=None
self, value=None, redirect=None, redirect_url=None, error_code=None, context={},
):
super(AuthFailedError, self).__init__()
self.value = Text(value)
self.redirect = redirect
self.redirect_url = redirect_url
self.error_code = error_code
self.context = context
def get_response(self):
""" Returns a dict representation of the error. """
resp = {'success': False}
for attr in ('value', 'redirect', 'redirect_url', 'error_code'):
for attr in ('value', 'redirect', 'redirect_url', 'error_code', 'context'):
if self.__getattribute__(attr):
resp[attr] = self.__getattribute__(attr)

View File

@@ -175,7 +175,13 @@ def _log_and_raise_inactive_user_auth_error(unauthenticated_user):
profile = UserProfile.objects.get(user=unauthenticated_user)
compose_and_send_activation_email(unauthenticated_user, profile)
raise AuthFailedError(error_code='inactive-user')
raise AuthFailedError(
error_code='inactive-user',
context={
'platformName': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'supportLink': configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK)
}
)
def _authenticate_first_party(request, unauthenticated_user, third_party_auth_requested):

View File

@@ -38,7 +38,7 @@ drf-yasg<1.17.1
# The team that owns this package will manually bump this package rather than having it pulled in automatically.
# This is to allow them to better control its deployment and to do it in a process that works better
# for them.
edx-enterprise==3.16.2
edx-enterprise==3.16.3
# We expect v2.0.0 to introduce large breaking changes in the feature toggle API
edx-toggles<2.0.0

View File

@@ -1,32 +0,0 @@
# Packages to install in the Python sandbox for secured execution of code provided by course authors.
#
# DON'T JUST ADD NEW DEPENDENCIES!!!
#
# If you open a pull request that adds a new dependency, you should:
# * verify that the dependency has a license compatible with AGPLv3
# * confirm that it has no system requirements beyond what we already install
# * run "make upgrade" to update the detailed requirements files
# We pin things specifically in this file beacuse we want to be very explicit about
# updating dependencies to the sandbox since they can impact how custom response code is run.
# We can then use constraints.txt to constrain any sub-dependencies that may need to be held back.
-c ../constraints.txt
-r shared.txt # Dependencies in common with LMS and Studio
chem # A helper library for chemistry calculations
matplotlib==2.2.4 # 2D plotting library
numpy==1.16.5 # Numeric array processing utilities; used by scipy
pyparsing==2.2.0 # Python Parsing module
random2==1.0.1 # Implementation of random module that works identically under Python 2 and 3
scipy==1.2.1 # Math, science, and engineering library
sympy==1.4 # Symbolic math library
git+https://github.com/edx/openedx-calc.git@e9b698c85ad1152002bc0868f475f153dce88952#egg=calc==0.4
# Install these packages from the edx-platform working tree
# NOTE: if you change code in these packages, you MUST change the version
# number in its setup.py or the code WILL NOT be installed during deploy.
-e common/lib/sandbox-packages
-e common/lib/symmath

View File

@@ -1,38 +0,0 @@
#
# This file has been frozen for the benefit of Python 2.7 sandboxes, and
# "make upgrade" no longer updates it. It can be removed once that
# version of the sandbox is no longer run in production. Before removal,
# the configuration repository needs to be updated to use the new file:
# https://github.com/edx/configuration/blob/master/playbooks/roles/edxapp/defaults/main.yml#L1628
# Also, this change needs to be announced and communicated to partners
# before implementation.
#
common/lib/sandbox-packages
common/lib/symmath
backports.functools-lru-cache==1.6.1 # via matplotlib
git+https://github.com/edx/openedx-calc.git@e9b698c85ad1152002bc0868f475f153dce88952#egg=calc==0.4
cffi==1.13.2
git+https://github.com/edx/openedx-chem.git@ff4e3a03d3c7610e47a9af08eb648d8aabe2eb18#egg=chem==1.0.0
cryptography==2.8
cycler==0.10.0 # via matplotlib
ipaddress==1.0.23
kiwisolver==1.1.0 # via matplotlib
lxml==3.8.0
markupsafe==1.1.1
matplotlib==2.2.4
networkx==1.7
nltk==3.4.5
numpy==1.7.2
pycparser==2.19
pyparsing==2.2.0
python-dateutil==2.8.1 # via matplotlib
pytz==2019.3 # via matplotlib
random2==1.0.1
scipy==0.14.0
singledispatch==3.4.0.3
six==1.13.0
subprocess32==3.5.4 # via matplotlib
sympy==0.7.1
# The following packages are considered to be unsafe in a requirements file:
# setuptools

View File

@@ -15,15 +15,15 @@
-c ../constraints.txt
-r shared.txt # Dependencies in common with LMS and Studio
chem
chem # A helper library for chemistry calculations
matplotlib==2.2.4 # 2D plotting library
networkx==2.2 # Utilities for creating, manipulating, and studying network graphs
numpy==1.16.5 # Numeric array processing utilities; used by scipy
openedx-calc
openedx-calc<2.0.0
pyparsing==2.2.0 # Python Parsing module
random2 # Implementation of random module that works identically under Python 2 and 3
scipy==1.2.1 # Math, science, and engineering library
sympy==1.6.2 # Symbolic math library
sympy==1.6.2 # Symbolic math library
# Install these packages from the edx-platform working tree
# NOTE: if you change code in these packages, you MUST change the version

View File

@@ -98,7 +98,7 @@ edx-django-release-util==0.4.4 # via -r requirements/edx/base.in
edx-django-sites-extensions==2.5.1 # via -r requirements/edx/base.in
edx-django-utils==3.13.0 # via -r requirements/edx/base.in, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-drf-extensions==6.2.0 # via -r requirements/edx/base.in, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
edx-enterprise==3.16.2 # via -c requirements/edx/../constraints.txt, -r requirements/edx/base.in
edx-enterprise==3.16.3 # via -c requirements/edx/../constraints.txt, -r requirements/edx/base.in
edx-event-routing-backends==2.0.0 # via -r requirements/edx/base.in
edx-i18n-tools==0.5.3 # via ora2
edx-milestones==0.3.0 # via -r requirements/edx/base.in

View File

@@ -109,7 +109,7 @@ edx-django-release-util==0.4.4 # via -r requirements/edx/testing.txt
edx-django-sites-extensions==2.5.1 # via -r requirements/edx/testing.txt
edx-django-utils==3.13.0 # via -r requirements/edx/testing.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-drf-extensions==6.2.0 # via -r requirements/edx/testing.txt, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
edx-enterprise==3.16.2 # via -c requirements/edx/../constraints.txt, -r requirements/edx/testing.txt
edx-enterprise==3.16.3 # via -c requirements/edx/../constraints.txt, -r requirements/edx/testing.txt
edx-event-routing-backends==2.0.0 # via -r requirements/edx/testing.txt
edx-i18n-tools==0.5.3 # via -r requirements/edx/testing.txt, ora2
edx-lint==1.6 # via -r requirements/edx/testing.txt

View File

@@ -106,7 +106,7 @@ edx-django-release-util==0.4.4 # via -r requirements/edx/base.txt
edx-django-sites-extensions==2.5.1 # via -r requirements/edx/base.txt
edx-django-utils==3.13.0 # via -r requirements/edx/base.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-toggles, edx-when, ora2, super-csv
edx-drf-extensions==6.2.0 # via -r requirements/edx/base.txt, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
edx-enterprise==3.16.2 # via -c requirements/edx/../constraints.txt, -r requirements/edx/base.txt
edx-enterprise==3.16.3 # via -c requirements/edx/../constraints.txt, -r requirements/edx/base.txt
edx-event-routing-backends==2.0.0 # via -r requirements/edx/base.txt
edx-i18n-tools==0.5.3 # via -r requirements/edx/base.txt, -r requirements/edx/testing.in, ora2
edx-lint==1.6 # via -r requirements/edx/testing.in