Skip to content

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 class.
In the settings from core/settings.py, the TermsAndConditionsRedirectMiddleware was added as default to the MIDDLEWARE. It will only have an effect when the ACCOUNT_TERMS_OF_USE is set to True.

# in rdmo/core/settings.py
MIDDLEWARE = [
    ....
    'rdmo.accounts.middleware.TermsAndConditionsRedirectMiddleware'
]

❗ Breaking Changes

Configuration in the rdmo-app

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

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
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
@MyPyDavid MyPyDavid force-pushed the feat-add-terms-of-use-middleware branch from bcbd456 to e25b960 Compare January 23, 2025 16:14
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
@MyPyDavid MyPyDavid force-pushed the feat-add-terms-of-use-middleware branch from e25b960 to 3c2a3bc Compare January 23, 2025 16:16
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
@MyPyDavid
Copy link
Member Author

can be reviewed when tests pass

@MyPyDavid MyPyDavid marked this pull request as ready for review February 4, 2025 08:20
@MyPyDavid MyPyDavid requested a review from jochenklar February 4, 2025 08:20
@MyPyDavid MyPyDavid changed the title Feat: add Terms of Use update view and middleware Feat: add Terms of Use accept view and middleware Feb 4, 2025
Copy link
Member

@jochenklar jochenklar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I think I will need test it some more with ORCID etc. when we have a release candidate, but I think this approach will work for all.

@MyPyDavid
Copy link
Member Author

Great work! I think I will need test it some more with ORCID etc. when we have a release candidate, but I think this approach will work for all.

I think what is still missing is the integration with the social signup form, like the account sign up already has.

…d add checks

Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
…ial tests

Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
@MyPyDavid MyPyDavid requested a review from jochenklar February 17, 2025 10:34
Copy link
Member

@jochenklar jochenklar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost done!

Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
@MyPyDavid MyPyDavid requested a review from jochenklar February 18, 2025 08:38
Copy link
Member

@jochenklar jochenklar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚂 Awesome, merge! (after tests)

@MyPyDavid MyPyDavid merged commit e9281a5 into 2.3.0 Feb 18, 2025
19 checks passed
@MyPyDavid MyPyDavid deleted the feat-add-terms-of-use-middleware branch February 18, 2025 09:49
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.

Social login does not show Terms of Use No Terms of Use when using Shibboleth

3 participants