fix: LTI 1.1 form URL is relative URL and LTI 1.3 form URL is expected to be absolute
This commit fixes a bug in the way that the the form_url is used in the Javascript. For LTI modal launches in the courseware microfrontend (MFE), the Javascript prepends the value of window.location.origin to the form_url when sending a message via postMessage to window.parent. This is because the form_url included in the template by the XBlock handler does not include a port and hostname for LTI 1.1 launches. In LTI 1.3, however, the form_url should include the port and hostname, because it's user input (e.g. fields on the XBlock). Because of this, LTI 1.3 modal launches do not work, because the Javascript appends a port and hostname to a URL that already has a port and hostname, resulting in something like "http://localhost:18000http//localhost..." This commit changes the way that the launch URL is calculated by the Javascript. The version of LTI being used is included in the template by the Python code, which is read by the Javascript. The Javascript then adds the port and hostname for LTI 1.1 form URLs but not for LTI 1.1 form URLs.
Showing
- lti_consumer/lti_xblock.py 1 addition, 0 deletionslti_consumer/lti_xblock.py
- lti_consumer/static/js/xblock_lti_consumer.js 16 additions, 2 deletionslti_consumer/static/js/xblock_lti_consumer.js
- lti_consumer/templates/html/student.html 1 addition, 0 deletionslti_consumer/templates/html/student.html
- lti_consumer/tests/unit/test_lti_xblock.py 1 addition, 1 deletionlti_consumer/tests/unit/test_lti_xblock.py
Loading
Please register or sign in to comment