Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add Terms of Use update view and middleware #1217

Draft
wants to merge 7 commits into
base: 2.3.0
Choose a base branch
from

Conversation

MyPyDavid
Copy link
Member

@MyPyDavid MyPyDavid commented Dec 18, 2024

Description

Related issue: #141, #161

It adds a migration for the ConsentFieldValue model: accounts.0022_add_created_updated_to_consent
So it requires a python manage.py migrate.
I have added some methods that handle the consent and session to the model.

configuration in the rdmo-app

When ACCOUNT_TERMS_OF_USE is enabled, some settings need to be configured in the rdmo-app as well.

In the settings from local.py:

if ACCOUNT_TERMS_OF_USE:
    MIDDLEWARE += [
        'rdmo.accounts.middleware.TermsAndConditionsRedirectMiddleware'
    ]

An optional feature is added that sets the date on which the ToU text is valid, so that it can be easily updated when the text might change. The optional setting is TERMS_VERSION_DATE and needs to be a valid date string that is compatible with formats from django get_format('DATE_INPUT_FORMATS'). The date of this setting checks if the user has updated their consent on or after that date, otherwise the consent is invalid and asked to accept again.

# for example
TERMS_VERSION_DATE = "2025-12-30"

Optionally, in the urls.py:

if settings.ACCOUNT_TERMS_OF_USE:
    from rdmo.accounts.views import terms_of_use, terms_of_use_accept
    urlpatterns += [
        path("account/terms-of-use/accept/", terms_of_use_accept, name="terms_of_use_accept"),
        path("account/terms-of-use/", terms_of_use, name="terms_of_use"),
    ]

Motivation and Context

How has this been tested?

Screenshots (if appropriate)

@MyPyDavid MyPyDavid self-assigned this Dec 18, 2024
@MyPyDavid MyPyDavid added this to the RDMO 2.3.0 milestone Dec 18, 2024
@MyPyDavid MyPyDavid force-pushed the feat-add-terms-of-use-middleware branch from bcbd456 to e25b960 Compare January 23, 2025 16:14
@MyPyDavid MyPyDavid force-pushed the feat-add-terms-of-use-middleware branch from e25b960 to 3c2a3bc Compare January 23, 2025 16:16
@MyPyDavid
Copy link
Member Author

can be reviewed when tests pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant