Skip to content
Snippets Groups Projects

This section explains the way we handle terms in the application.

Description

The terms version is handled with the io.cozy.terms doctype. It is incremented each time we edit the CGU, the data consent validation or the legal notices. Once we increment the terms version, the user will be prompted to accept these terms, otherwise we won't be able to access the app.

Private Routes

All routes are private, and are accessible only if the user has accepted the last version of the terms. The only public routes are :

  • /terms : shows the terms validation page, and is the main page the user is redirected to if his consent is outdated
  • /cgu : shows the CGU public page, accessible by the terms page
  • /legal : shows the Legal Notice public page, accessible by the terms page

Terms managment

We check the terms acceptation in the SplashScreen while the application is initializing, if there is no consent (first connexion), or the consent is outdated (update of terms), the user will be redirected to the terms acceptation page.

For the full terms acceptation process, the user has to check the two checboxes (one for Data share consent, and one for CGU and Legal Notice) to unlock the terms acceptation button. Once he has accepted it, a new term doctype is created with the value accepted to true. So he can access now the entire application. We store in user's profile a boolean showConsentModal that allows the app to know about the consent status.

If there is a consent update, two cases are possible :

  • It's a major update, ex: from 1.X.X to 2.X.X, the user has to go through the entire term validation process as explained above
  • It's a minor update, ex: from 1.1.X to 1.3.X or from 1.2.1 to 1.2.3, the user is just prompted with a modal with some text about the update, and a link to the legal notice, but there is no blocking acceptation input for the user.

Version number

The version number of the last terms is stored in the config.json file. If this version number doesn't correspond with the last term accepted, according the update version type (minor or major), the user won't be able to access the app and will be prompted to accept new terms or will simply be prompted.

Global state

Once the verification done in the SplashScreen, the last term state is stored in the redux store under the ecolyo.global state.

The model is the following :

  termsStatus: {
    accepted: boolean,
    versionType: 'major' | 'minor' | 'init',
  },

Major and minor value are only used in the case of an update. Otherwise we store the value 'init' which corresponds either to a first connexion or to case the last accepted term version is uptodate.