diff --git a/common/lib/xmodule/xmodule/js/src/lti/lti.js b/common/lib/xmodule/xmodule/js/src/lti/lti.js index e5b6885e1bbf534a1005ed625b011ae78d35bfe6..7d5b183f216ba9e5139427dce8aa87a97316e02d 100644 --- a/common/lib/xmodule/xmodule/js/src/lti/lti.js +++ b/common/lib/xmodule/xmodule/js/src/lti/lti.js @@ -16,9 +16,9 @@ window.LTI = (function () { // If the Form's action attribute is set (i.e. we can perform a normal // submit), then we submit the form and make the frame shown. - if (form.attr('action')) { + if (form.attr('action') && form.attr('action') !== 'http://www.example.com') { form.submit(); - element.find('.lti').addClass('rendered') + element.find('.lti').addClass('rendered'); } } diff --git a/common/lib/xmodule/xmodule/lti_module.py b/common/lib/xmodule/xmodule/lti_module.py index 939190840aea343c8247da680640c7bca5b9204f..0144071a19076f494ab48cb8a189d8c8b6f82941 100644 --- a/common/lib/xmodule/xmodule/lti_module.py +++ b/common/lib/xmodule/xmodule/lti_module.py @@ -38,9 +38,12 @@ class LTIFields(object): vbid=put_book_id_here book_location=page/put_page_number_here + Default non-empty url for `launch_url` is needed due to oauthlib demand (url scheme should be presented):: + + https://github.com/idan/oauthlib/blob/master/oauthlib/oauth1/rfc5849/signature.py#L136 """ lti_id = String(help="Id of the tool", default='', scope=Scope.settings) - launch_url = String(help="URL of the tool", default='', scope=Scope.settings) + launch_url = String(help="URL of the tool", default='http://www.example.com', scope=Scope.settings) custom_parameters = List(help="Custom parameters (vbid, book_location, etc..)", scope=Scope.settings) @@ -213,7 +216,6 @@ class LTIModule(LTIFields, XModule): body.update(custom_parameters) headers = { - 'Host': self.system.HOSTNAME, # This is needed for body encoding: 'Content-Type': 'application/x-www-form-urlencoded', } diff --git a/lms/djangoapps/courseware/tests/test_lti.py b/lms/djangoapps/courseware/tests/test_lti.py index 71b5a1c3bb9f69e2e5100f1f0145c60a900f4c7a..596ec2dd9a19ab3013395d62827d8c979c582891 100644 --- a/lms/djangoapps/courseware/tests/test_lti.py +++ b/lms/djangoapps/courseware/tests/test_lti.py @@ -75,6 +75,6 @@ class TestLTI(BaseTestXmodule): 'input_fields': self.correct_headers, 'element_class': self.item_module.location.category, 'element_id': self.item_module.location.html_id(), - 'launch_url': '', # default value + 'launch_url': 'http://www.example.com', # default value } self.assertDictEqual(generated_context, expected_context)