diff --git a/fittrackee_client/src/components/PrivacyPolicyToAccept.vue b/fittrackee_client/src/components/PrivacyPolicyToAccept.vue new file mode 100644 index 00000000..e6c837b4 --- /dev/null +++ b/fittrackee_client/src/components/PrivacyPolicyToAccept.vue @@ -0,0 +1,25 @@ + + + + + + {{ $t('user.REVIEW') }} + + + + + + + + + diff --git a/fittrackee_client/src/components/User/ProfileEdition/UserPrivacyPolicyValidation.vue b/fittrackee_client/src/components/User/ProfileEdition/UserPrivacyPolicyValidation.vue new file mode 100644 index 00000000..2f5602c5 --- /dev/null +++ b/fittrackee_client/src/components/User/ProfileEdition/UserPrivacyPolicyValidation.vue @@ -0,0 +1,121 @@ + + + + + + + + {{ $t('privacy_policy.TITLE') }} + + + + + {{ $t('user.PROFILE.BACK_TO_PROFILE') }} + + + + + + + + + + + {{ $t('privacy_policy.TITLE') }} + + + + + {{ $t('user.I_WANT_TO_DELETE_MY_ACCOUNT') }} + + + + {{ $t('buttons.SUBMIT') }} + + + {{ $t('user.PROFILE.BACK_TO_PROFILE') }} + + + + + + + + + diff --git a/fittrackee_client/src/components/User/ProfileEdition/index.vue b/fittrackee_client/src/components/User/ProfileEdition/index.vue index a452c405..987e354e 100644 --- a/fittrackee_client/src/components/User/ProfileEdition/index.vue +++ b/fittrackee_client/src/components/User/ProfileEdition/index.vue @@ -34,7 +34,7 @@ const store = useStore() const { user, tab } = toRefs(props) - const tabs = ['PROFILE', 'ACCOUNT', 'PICTURE', 'PREFERENCES', 'SPORTS'] + const tabs = ['PROFILE', 'ACCOUNT', 'PICTURE', 'PREFERENCES', 'SPORTS', 'PRIVACY-POLICY'] const loading = computed( () => store.getters[AUTH_USER_STORE.GETTERS.USER_LOADING] ) diff --git a/fittrackee_client/src/components/User/UserProfileTabs.vue b/fittrackee_client/src/components/User/UserProfileTabs.vue index 2fff76f7..a68f8d3f 100644 --- a/fittrackee_client/src/components/User/UserProfileTabs.vue +++ b/fittrackee_client/src/components/User/UserProfileTabs.vue @@ -37,6 +37,7 @@ switch (tab) { case 'ACCOUNT': case 'PICTURE': + case 'PRIVACY-POLICY': return `/profile/edit/${tab.toLocaleLowerCase()}` case 'APPS': case 'PREFERENCES': diff --git a/fittrackee_client/src/locales/en/user.json b/fittrackee_client/src/locales/en/user.json index e4661a99..f0e90611 100644 --- a/fittrackee_client/src/locales/en/user.json +++ b/fittrackee_client/src/locales/en/user.json @@ -10,8 +10,10 @@ "ENTER_PASSWORD": "Enter a password", "FILTER_ON_USERNAME": "Filter on username", "HIDE_PASSWORD": "hide password", + "I_WANT_TO_DELETE_MY_ACCOUNT": "I want to delete my account", "INVALID_TOKEN": "Invalid token, please request a new password reset.", "LANGUAGE": "Language", + "LAST_PRIVACY_POLICY_TO_VALIDATE": "The privacy policy has been updated, please {0} it before proceeding.", "LOGIN": "Login", "LOGOUT": "Logout", "LOG_IN": "log in", @@ -68,6 +70,7 @@ "PICTURE_REMOVE": "Remove picture", "PICTURE_UPDATE": "Update picture", "PREFERENCES_EDITION": "Preferences edition", + "PRIVACY-POLICY_EDITION": "Privacy policy", "PROFILE_EDITION": "Profile edition", "REGISTRATION_DATE": "Registration date", "SPORT": { @@ -89,6 +92,7 @@ "APPS": "apps", "PICTURE": "picture", "PREFERENCES": "preferences", + "PRIVACY-POLICY": "privacy policy", "PROFILE": "profile", "SPORTS": "sports" }, @@ -104,9 +108,11 @@ "REGISTER_DISABLED": "Sorry, registration is disabled.", "RESENT_ACCOUNT_CONFIRMATION": "Resend account confirmation email", "RESET_PASSWORD": "Reset your password", + "REVIEW": "review", "SHOW_PASSWORD": "show password", "THIS_USER_ACCOUNT_IS_INACTIVE": "This user account is inactive.", "USERNAME": "Username", "USERNAME_INFO": "3 to 30 characters required, only alphanumeric characters and the underscore character \"_\" allowed.", - "USER_PICTURE": "user picture" + "USER_PICTURE": "user picture", + "YOU_HAVE_ACCEPTED_PRIVACY_POLICY": "You have accepted the {0}." } \ No newline at end of file diff --git a/fittrackee_client/src/locales/fr/user.json b/fittrackee_client/src/locales/fr/user.json index f519d435..9bfe86ad 100644 --- a/fittrackee_client/src/locales/fr/user.json +++ b/fittrackee_client/src/locales/fr/user.json @@ -10,8 +10,10 @@ "ENTER_PASSWORD": "Saisissez un mot de passe", "FILTER_ON_USERNAME": "Filtrer sur le nom d'utilisateur", "HIDE_PASSWORD": "masquer le mot de passe", + "I_WANT_TO_DELETE_MY_ACCOUNT": "Je souhaite supprimer mon compte", "INVALID_TOKEN": "Jeton invalide, veuillez demander une nouvelle réinitialisation de mot de passe.", "LANGUAGE": "Langue", + "LAST_PRIVACY_POLICY_TO_VALIDATE": "La politique de confidentialité a été mise à jour. Veuillez l'{0} avant de poursuivre.", "LOGIN": "Se connecter", "LOGOUT": "Se déconnecter", "LOG_IN": "connecter", @@ -68,6 +70,7 @@ "PICTURE_REMOVE": "Supprimer", "PICTURE_UPDATE": "Mettre à jour l'image", "PREFERENCES_EDITION": "Mise à jour des préférences", + "PRIVACY-POLICY_EDITION": "Politique de confidentialité", "PROFILE_EDITION": "Mise à jour du profil", "REGISTRATION_DATE": "Date d'inscription", "SPORT": { @@ -89,6 +92,7 @@ "APPS": "apps", "PICTURE": "image", "PREFERENCES": "préférences", + "PRIVACY-POLICY": "politique de confidentialité", "PROFILE": "profil", "SPORTS": "sports" }, @@ -104,9 +108,11 @@ "REGISTER_DISABLED": "Désolé, les inscriptions sont désactivées.", "RESENT_ACCOUNT_CONFIRMATION": "Envoyer à nouveau le courriel de confirmation de compte", "RESET_PASSWORD": "Réinitialiser votre mot de passe", + "REVIEW": "accepter", "SHOW_PASSWORD": "afficher le mot de passe", "THIS_USER_ACCOUNT_IS_INACTIVE": "Le compte de cet utilisateur est inactif.", "USERNAME": "Nom d'utilisateur", "USERNAME_INFO": "3 à 30 caractères requis, seuls les caractères alphanumériques et le caractère _ sont autorisés.", - "USER_PICTURE": "photo de l'utilisateur" + "USER_PICTURE": "photo de l'utilisateur", + "YOU_HAVE_ACCEPTED_PRIVACY_POLICY": "Vous avez accepté la {0}." } \ No newline at end of file diff --git a/fittrackee_client/src/router/index.ts b/fittrackee_client/src/router/index.ts index da273a73..3c69d5b6 100644 --- a/fittrackee_client/src/router/index.ts +++ b/fittrackee_client/src/router/index.ts @@ -12,6 +12,7 @@ import UserAccountEdition from '@/components/User/ProfileEdition/UserAccountEdit import UserInfosEdition from '@/components/User/ProfileEdition/UserInfosEdition.vue' import UserPictureEdition from '@/components/User/ProfileEdition/UserPictureEdition.vue' import UserPreferencesEdition from '@/components/User/ProfileEdition/UserPreferencesEdition.vue' +import UserPrivacyPolicyValidation from '@/components/User/ProfileEdition/UserPrivacyPolicyValidation.vue' import AddUserApp from '@/components/User/UserApps/AddUserApp.vue' import AuthorizeUserApp from '@/components/User/UserApps/AuthorizeUserApp.vue' import UserApps from '@/components/User/UserApps/index.vue' @@ -219,6 +220,11 @@ const routes: Array = [ component: UserSportPreferences, props: { isEdition: true }, }, + { + path: 'privacy-policy', + name: 'UserPrivacyPolicy', + component: UserPrivacyPolicyValidation, + }, ], }, ], diff --git a/fittrackee_client/src/store/modules/authUser/actions.ts b/fittrackee_client/src/store/modules/authUser/actions.ts index 144127c4..7954f11e 100644 --- a/fittrackee_client/src/store/modules/authUser/actions.ts +++ b/fittrackee_client/src/store/modules/authUser/actions.ts @@ -427,4 +427,24 @@ export const actions: ActionTree & }) .catch((error) => handleError(context, error)) }, + [AUTH_USER_STORE.ACTIONS.ACCEPT_PRIVACY_POLICY]( + context: ActionContext, + acceptedPolicy: boolean + ): void { + context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES) + authApi + .post('auth/account/privacy-policy', { + accepted_policy: acceptedPolicy, + }) + .then((res) => { + if (res.data.status === 'success') { + context + .dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE) + .then(() => router.push('/profile')) + } else { + handleError(context, null) + } + }) + .catch((error) => handleError(context, error)) + }, } diff --git a/fittrackee_client/src/store/modules/authUser/enums.ts b/fittrackee_client/src/store/modules/authUser/enums.ts index ec743344..9734f7f8 100644 --- a/fittrackee_client/src/store/modules/authUser/enums.ts +++ b/fittrackee_client/src/store/modules/authUser/enums.ts @@ -1,4 +1,5 @@ export enum AuthUserActions { + ACCEPT_PRIVACY_POLICY = 'ACCEPT_PRIVACY_POLICY', CHECK_AUTH_USER = 'CHECK_AUTH_USER', CONFIRM_ACCOUNT = 'CONFIRM_ACCOUNT', CONFIRM_EMAIL = 'CONFIRM_EMAIL', diff --git a/fittrackee_client/src/store/modules/authUser/types.ts b/fittrackee_client/src/store/modules/authUser/types.ts index 0dfed114..91463a61 100644 --- a/fittrackee_client/src/store/modules/authUser/types.ts +++ b/fittrackee_client/src/store/modules/authUser/types.ts @@ -110,6 +110,11 @@ export interface IAuthUserActions { [AUTH_USER_STORE.ACTIONS.DELETE_PICTURE]( context: ActionContext ): void + + [AUTH_USER_STORE.ACTIONS.ACCEPT_PRIVACY_POLICY]( + context: ActionContext, + acceptedPolicy: boolean + ): void } export interface IAuthUserGetters { diff --git a/fittrackee_client/src/types/user.ts b/fittrackee_client/src/types/user.ts index 3d3be44b..0d6def3a 100644 --- a/fittrackee_client/src/types/user.ts +++ b/fittrackee_client/src/types/user.ts @@ -25,6 +25,7 @@ export interface IUserProfile { } export interface IAuthUserProfile extends IUserProfile { + accepted_privacy_policy: boolean display_ascent: boolean imperial_units: boolean language: string | null diff --git a/fittrackee_client/src/views/Dashboard.vue b/fittrackee_client/src/views/Dashboard.vue index 7660c735..bd72ed70 100644 --- a/fittrackee_client/src/views/Dashboard.vue +++ b/fittrackee_client/src/views/Dashboard.vue @@ -36,6 +36,12 @@ + + + @@ -80,6 +86,7 @@ import UserMonthStats from '@/components/Dashboard/UserMonthStats.vue' import UserRecords from '@/components/Dashboard/UserRecords/index.vue' import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue' + import PrivacyPolicyToAccept from '@/components/PrivacyPolicyToAccept.vue' import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants' import { ISport } from '@/types/sports' import { IAuthUserProfile } from '@/types/user' @@ -126,6 +133,11 @@ display: none; } + .privacy-policy-message { + display: flex; + justify-content: center; + } + @media screen and (max-width: $medium-limit) { padding-bottom: 60px; .dashboard-container {
+ + + {{ $t('privacy_policy.TITLE') }} + + +