django-termsandconditions icon indicating copy to clipboard operation
django-termsandconditions copied to clipboard

Repeated T&C redirections and cut text

Open indev-22 opened this issue 2 years ago • 1 comments

Hello,

We implemented django-termsandconditions in two projects and both have issues when users accept the T&C, sometimes happen:

  1. After acceptance, T&C page appears again. If user exits the website and enters again, all is fine.
  2. When the T&C appears again, sometimes only the first and a half line is displayed.
  3. If T&C are correctly accepted and the redirection succeeds, if user goes to another page, then, T&C appear again.

In all cases the registry of acceptance is correctly added in the DB.

settings.py:

# Terms and conditions setup
TERMS_BASE_TEMPLATE = 'web_manager/base.html'
TERMS_EXCLUDE_URL_CONTAINS_LIST = {'/terms/', '/i18n/setlang/', }
TERMS_CACHE_SECONDS = 30    # 10 in the other project

MIGRATION_MODULES = {
    # local path for migration for the termsandconditions
    'termsandconditions': 'company.migrations.migrations_termsandconditions',
}

If developers provide an email, we can share a private video with the issues.

Thanks.

indev-22 avatar Sep 19 '22 13:09 indev-22

Hello! Sorry you are having this trouble!

I re-tested everything with your settings, and I was not able to replicate this issue with a fresh project.

Some things you might take a look at:

  1. The middleware is what does the check to see if terms have been accepted by querying the database. The order of the middleware might be affecting things here, if perhaps something is affecting the output of that middleware.

  2. The database query is here: https://github.com/cyface/django-termsandconditions/blob/a54fd68f6c95a54d1aa6bd6c83603c21268276c5/termsandconditions/models.py#L192. If that query is still returning that the user has not accepted the terms (perhaps in the situation where DB queries are cached, or you have multiple back-end database nodes where one has been updated but the other has not yet), that might cause the query to still return false for the user.

  3. For the cut text; if perhaps the database query is being cached, perhaps only the top is being cached. Otherwise, this feels most likely to be a CSS / Javascript / HTML issue on your accept-terms template.

  4. Finally, if you have more than one active terms set up in the database, it will go through each of them asking them to be accepted. If you have one of those that has less than the full text, that might be appearing as the cut text you describe.

Good luck, and sorry again you are having issues!

cyface avatar Sep 26 '22 02:09 cyface