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

Add prompt to consent to terms and conditions on first use #1103

Closed
wants to merge 3 commits into from

Conversation

owi92
Copy link
Member

@owi92 owi92 commented Feb 12, 2024

Closes #1023

This adds a simple modal asking the user to agree to configurable terms and conditions.
The modal can only be closed by agreeing. So if a user doesn't agree, they cannot use Tobira.

Right now this is only done when a user first visits Tobira prior to logging in, so it doesn't store any
user information per se. This means consent is given per device/browser and not per user.

Still subject to change or be expanded with additional consent needed after logging in.

I'm marking this as a draft, since that is what it is, but I would still appreciate a review and feedback.

Edit: Tests need to be rewritten for this. I'd definitely want to wait for @LukasKalbertodt playwright changes.

@owi92 owi92 added the changelog:user User facing changes label Feb 12, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1103 February 12, 2024 17:09 Destroyed
@owi92 owi92 force-pushed the terms-and-conditions branch from 46e7e23 to 52986f7 Compare February 12, 2024 17:20
@github-actions github-actions bot temporarily deployed to test-deployment-pr1103 February 12, 2024 17:26 Destroyed
@owi92 owi92 force-pushed the terms-and-conditions branch from 52986f7 to 61c32a6 Compare February 12, 2024 17:30
@github-actions github-actions bot temporarily deployed to test-deployment-pr1103 February 12, 2024 17:32 Destroyed
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

I'm fine with first just merging the localStorage-only solution. As you've written in the issue, I don't see the point of the DB solution if the user can't even login without agreeing to the terms and conditions...

Comment on lines +6 to +16
[general.initial_consent]
title.en = "Terms & Conditions"
button.en = "Agree"
text.en = """
By using this video portal, you agree to our terms and conditions.

For more information, see:
- [Our terms](https://www.our.terms)
- [Our conditions](https://www.our.conditions)
"""

Copy link
Member

Choose a reason for hiding this comment

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

I would not add this to our test deployment. That would be super annoying.

Though of course I appreciate it for the test deployment of this PR :D maybe remove this right before merging.

Comment on lines +9 to +19
[general.initial_consent]
title.en = "Terms & Conditions"
button.en = "Agree"
text.en = """
By using this video portal, you agree to our terms and conditions.

For more information, see:
- [Our terms](https://www.our.terms)
- [Our conditions](https://www.our.conditions)
"""

Copy link
Member

Choose a reason for hiding this comment

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

Similarly I would not add this to our dev config, equally annoying for devs.

Now you might say: but then we don't "automatically" regularly test this. Correct. Mir wurscht :P I don't want to see these prompts every single day. And more seriously: I don't think this feature, once working, will easily break. So not testing it regularly is fine IMO.

frontend/src/config.ts Outdated Show resolved Hide resolved
backend/src/config/general.rs Outdated Show resolved Hide resolved
frontend/src/ui/InitialConsent.tsx Outdated Show resolved Hide resolved
frontend/src/ui/InitialConsent.tsx Outdated Show resolved Hide resolved
frontend/src/ui/InitialConsent.tsx Outdated Show resolved Hide resolved
return (hash >>> 0).toString(36);
};

const hash = simpleHash(CONFIG.initialConsent.toString());
Copy link
Member

Choose a reason for hiding this comment

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

Calling toString() on an object returns "[object Object]". This needs to be done differently.

Though now I'm wondering... we can concat all strings and hash that. But we have to make sure that we always concat them in the same order. But more importantly: if a new language is added, the hash changes and everyone has to agree again. And if it is changed in a language other than the one you agreed to, then the same happens.

Do we want to avoid that? Then maybe we should store in local storage the language key and the hash? Then, to check if the user needs to re-confirm, we only concat the strings of the language in the local storage and compare the hash?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, yeah I think that makes sense. I forgot that in my recent push, will look into it tomorrow.

frontend/src/layout/Root.tsx Outdated Show resolved Hide resolved
frontend/src/ui/InitialConsent.tsx Outdated Show resolved Hide resolved
@owi92 owi92 force-pushed the terms-and-conditions branch from 61c32a6 to c492a32 Compare February 13, 2024 22:46
@owi92
Copy link
Member Author

owi92 commented Feb 13, 2024

Let me know if/when you're ok with these changes, then I'll remove the pre-configured values from the test and dev config. Also, tests are expected to fail while these are still configured.

@github-actions github-actions bot temporarily deployed to test-deployment-pr1103 February 13, 2024 22:52 Destroyed

This comment was marked as resolved.

@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Feb 14, 2024
@owi92 owi92 changed the title Consent to terms and conditions on first use Add prompt to consent to terms and conditions on first use Feb 15, 2024
backend/src/config/general.rs Outdated Show resolved Hide resolved
frontend/src/ui/InitialConsent.tsx Show resolved Hide resolved
frontend/src/ui/InitialConsent.tsx Outdated Show resolved Hide resolved
frontend/src/ui/InitialConsent.tsx Outdated Show resolved Hide resolved
This holds configurable title, text and button label
for the terms and conditions prompt.
This is a really basic consent modal, that is only
closeable by agreeing to the configured terms and
conditions. Users are prompted when first visiting
Tobira.
The consent is saved in local storage, meaning it is
done on a per-device basis rather than per-user.
Users are re-prompted once anything in the T&Cs changes.
@owi92 owi92 force-pushed the terms-and-conditions branch from c492a32 to 1902db7 Compare February 19, 2024 10:37
@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Feb 19, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1103 February 19, 2024 10:42 Destroyed
@owi92
Copy link
Member Author

owi92 commented Feb 20, 2024

Closed in favor of #1112

@owi92 owi92 closed this Feb 20, 2024
owi92 added a commit that referenced this pull request Feb 20, 2024
Supersedes  #1103 
Closes #1023 

The consent is stored in local storage, and thus is bound to a device (+
browser & OS) and not to a (logged-in) user. We need this functionality
anyway for users that never log in. In #1023 it was suggested that we
also store the consent in the DB for logged-in users. In theory that
means logged-in users never see the prompt again, but in practice this
is not useful: since the prompt is in front of everything, the user has
to agree to it before logging in. So the DB-stored value would never be
used, except in very rare cases.

Tobira asks for consent again once the configured texts change. Or more
specifically: the texts in the language shown to the user when clicking
"Agree". That means new languages can be added without re-prompting all
users.
@owi92 owi92 deleted the terms-and-conditions branch March 4, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:user User facing changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consent to Terms and Conditions on first use
2 participants