Resolve "CGU validation"
The following merge request attempts to serve a ToS validation system. It can manage several ToS version. It has been developed as a mixin that is added to every view where a login is required.
The system is based on two models. A model called
Tos that stores the data itself of the policy using a version number and a link to a PDF version if necessary. The content of the policy should be written in markdown. Another model called
UserAgreement just stores the user and its related ToS version in order for the user to be able to sign several versions.
I added a view to display the latest version of the ToS. This include a specific url, its related view and template. I edited the footer as well to add a link to the ToS.
Lastely, I added a mixin that checks if the user has accepted the latest ToS version. If not the user is redirected to the ToS validation view. Once accepted the user is redirected to the page he asked first. I updated all the
login required views by adding this new mixin.
I should mention that I see a major issue regarding the user redirection once he has accepted the ToS. The redirection argument passed to the ToS validation view is the url name which is not a good practice I think. A better case would to use the path (
request.path) but I wasn't able to write the right regex in the url dispatcher.
Another issue is that the user won't be redirected at login or sign up to the ToS validation view. This should be handled in the
Closes #279 (closed)