abelardopardo / ontask_b

A platform offering teachers and educational designers the capacity to use data to personalise the learner experience.
https://ontasklearning.org
MIT License
42 stars 35 forks source link

ontask11.1, admin panel post actions got 403 denied message, we add CSRF_TRUSTED_ORIGINS in base.py , to solve the issue #267

Open whol019 opened 4 months ago

whol019 commented 4 months ago

Describe the bug Ontask11.1 as title. we could not update user settings in admin panel. found out the log in django.log WARNING [/var/www/html/ontask/venv/lib/python3.9/site-packages/django/utils/log.py:241] Forbidden (Origin checking failed - https://ontask.test.xxx.xxx.xxx does not match any trusted origins.): /otaontask/user/2 /change/

To Reproduce Steps to reproduce the behavior:

  1. Go to 'admin'
  2. Click on 'users'
  3. edit any user settings and save.
  4. See error

Solution add CSRF_TRUSTED_ORIGINS with our host in the settings/base.py
CSRF_TRUSTED_ORIGINS = ['https://ontask.xxx.xxx.xxx']

Not sure why we did not required it in the past, maybe webroute environment changed etc.