SUNET / sri-front

Frontend code for the SRI project
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Fix NOCLook urls and buttons #322

Open PaKZer0 opened 3 years ago

PaKZer0 commented 3 years ago

Since the path where NOCLook is deployed changed to the root of the url path to '/api/' some NOCLook form buttons stopped working.

To solve this we should locate absolute urls in the templates and append the context variable script_name, which holds the value where the django app is deployed.

Like here: https://github.com/SUNET/ni/blob/master/src/niweb/apps/noclook/templates/noclook/detail/base_detail.html#L29

Also the CSRF token policy had been enforced by request after a security audition, some NOCLook js forms also stopped working.

To fix this we should find the jquery asynchronous petitions to the tastypie api, most of them present at the begining of https://github.com/SUNET/ni/blob/master/src/niweb/apps/noclook/templates/noclook/edit/base_edit.html#L25

Then the CSRF value should be added to this requests as it's explained here: https://docs.djangoproject.com/en/3.1/ref/csrf/#ajax