Unverified Commit d7ed1902 authored by Maarten de Waard's avatar Maarten de Waard 🤘🏻
Browse files

add something in documentation about proxies. Also make totp problem fit inside iframe in example

parent 5a619d17
Pipeline #11597 passed with stages
in 2 minutes and 51 seconds
......@@ -16,3 +16,4 @@ src/sass/_vars.scss
*.swp
# vscode settings.json
settings.json
.vscode
......@@ -144,15 +144,21 @@ the application is delivered in, containing the html files for that locale.
Adding the problem to a course
------------------------------
The problems are hosted at
``https://totem-project.org/js-components/<locale>/<problem>.html``
You can add a problem as a "Javascript Display and Grading", or as HTML only.
The first option contains a Submit button, applicable for example to check if
the TOTP problem was completed successfully. The latter will only include the
problem in the course, for example to show your IP address information.
the TOTP problem was completed successfully. The latter is simpler to set up,
but has no submit button.
For the submit button to work, the
problem needs to be hosted on your edX instance. We chose to host our problems
via a proxy available in the CMS *and* LMS at `/js-components/`.
If you want a "Submit" button with your problem:
Adding a problem with a Submit button
+++++++++++++++++++++++++++++++++++++
The problems available at
``/js-components/<locale>/<problem>.html`` (for example
https://learn.totem-project.org/js-components/en/problem_password.html).
- Add New Component: **Problem**
- Click on **Advanced**
......@@ -163,17 +169,6 @@ If you want a "Submit" button with your problem:
- Make sure the ``html_file`` attribute contains a link to the locale your
course is in.
Or, if you don't need a Submit button:
- Add New Component: **Problem**
- Click on **HTML**
- Click on **Edit**
- Click the **HTML** button in the editor, so you can paste raw HTML.
- Now, you need to paste the contents from this repository's
``examples/<your-problem.html>-no-submit-button.html`` into the editor.
- Make sure the ``src`` attribute contains a link to the locale your course is
in.
- **Optional**:
- Click on **Settings**
......@@ -188,6 +183,46 @@ Or, if you don't need a Submit button:
- Find **Show reset button** and set it to ``True``, this will allow
students to reset the state of the problem.
Adding a problem without a Submit button
++++++++++++++++++++++++++++++++++++++++
- Add New Component: **Problem**
- Click on **HTML**
- Click on **Edit**
- Click the **HTML** button in the editor, so you can paste raw HTML.
- Now, you need to paste the contents from this repository's
``examples/<your-problem.html>-no-submit-button.html`` into the editor.
- Make sure the ``src`` attribute contains a link to the locale your course is
in.
- **NOTE**
- If you don't need a submit button you don't need to have your problems
hosted on your edX instance. You can use
``src="//totem-project.org/js-components/<locale>/<problem>`` in the iframe.
Setting up a proxy for problems with a submit button
++++++++++++++++++++++++++++++++++++++++++++++++++++
The Submit button of a JavaScript Display and Grading problem in edX tries to
access the javascript inside the iframe. For this to work, the iframe needs to
be hosted on the same domain as the learning environment. For that reason, we
set up a proxy. To set up a proxy on your edX instance:
- edit the nginx ``lms`` and ``cms`` configuration. If you host with tutor, you can
find the configuration files at ``~/.local/share/tutor/env/apps/nginx``,
otherwise they are at ``/edx/app/nginx/sites-available/``.
- Under the ``server`` definition, add this ``location``:
.. code-block:: nginx
location /js-components/ {
proxy_ssl_verify on;
proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
proxy_pass https://totem-project.org/js-components/;
proxy_ssl_server_name on;
}
Developing on this problem
--------------------------
......
......@@ -21,8 +21,8 @@ def check_function(e, resp):
set_statefn="setState"
initial_state=''
width="600"
height="400"
html_file="//totem-project.org/js-components/en/problem_totp.html"
height="750"
html_file="/js-components/en/problem_totp.html"
title="Multi Factor Authentication problem"
sop="true"/>
</customresponse>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment