From 0ab4d903d958c1564e73c2ff1ab5a766b3648ea7 Mon Sep 17 00:00:00 2001 From: Andrea Barbasso <´andrea.barbasso@4science.com´> Date: Thu, 31 Oct 2024 10:44:27 +0100 Subject: [PATCH] [CST-15593] fix orejime cookie name, a11y issues and package-lock --- cypress/support/e2e.ts | 4 ++-- package-lock.json | 19 ++++++++++++++++++- .../google-recaptcha.service.ts | 2 +- .../register-email-form.component.ts | 2 +- .../shared/cookies/orejime-configuration.ts | 2 +- src/styles/_custom_variables.scss | 2 +- src/styles/_global-styles.scss | 2 +- 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index c1b6bc6d3fd..3c9f4e7b56f 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -54,9 +54,9 @@ before(() => { // Runs once before the first test in each "block" beforeEach(() => { - // Pre-agree to all Orejime cookies by setting the orejime-anonymous cookie + // Pre-agree to all Orejime cookies by setting the orejime cookie // This just ensures it doesn't get in the way of matching other objects in the page. - cy.setCookie('orejime-anonymous', '{%22authentication%22:true%2C%22preferences%22:true%2C%22acknowledgement%22:true%2C%22google-analytics%22:true%2C%22google-recaptcha%22:true}'); + cy.setCookie('orejime', '{%22authentication%22:true%2C%22preferences%22:true%2C%22acknowledgement%22:true%2C%22google-analytics%22:true%2C%22google-recaptcha%22:true}'); // Remove any CSRF cookies saved from prior tests cy.clearCookie(DSPACE_XSRF_COOKIE); diff --git a/package-lock.json b/package-lock.json index 43798601f99..4cbcfca9169 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5975,6 +5975,7 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.4.1.tgz", "integrity": "sha512-HNjmfLQEVRZmHRET336f20H/8kOozUGwk7yajvsonjNxbj2wBTK1WsQuHkD5yYh9RxFGL2EyDHryOihOwUoKDA==", + "dev": true, "dependencies": { "detect-libc": "^1.0.3", "is-glob": "^4.0.3", @@ -6010,6 +6011,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "android" @@ -6029,6 +6031,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "darwin" @@ -6048,6 +6051,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "darwin" @@ -6067,6 +6071,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "freebsd" @@ -6086,6 +6091,7 @@ "cpu": [ "arm" ], + "dev": true, "optional": true, "os": [ "linux" @@ -6105,6 +6111,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -6124,6 +6131,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -6143,6 +6151,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -6162,6 +6171,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -6181,6 +6191,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "win32" @@ -6200,6 +6211,7 @@ "cpu": [ "ia32" ], + "dev": true, "optional": true, "os": [ "win32" @@ -6219,6 +6231,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "win32" @@ -6234,7 +6247,8 @@ "node_modules/@parcel/watcher/node_modules/node-addon-api": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", - "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==" + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", @@ -10735,6 +10749,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, "bin": { "detect-libc": "bin/detect-libc.js" }, @@ -20599,6 +20614,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", + "dev": true, "dependencies": { "readdirp": "^4.0.1" }, @@ -20619,6 +20635,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==", + "dev": true, "engines": { "node": ">= 14.16.0" }, diff --git a/src/app/core/google-recaptcha/google-recaptcha.service.ts b/src/app/core/google-recaptcha/google-recaptcha.service.ts index c23223b6785..580bc876f42 100644 --- a/src/app/core/google-recaptcha/google-recaptcha.service.ts +++ b/src/app/core/google-recaptcha/google-recaptcha.service.ts @@ -105,7 +105,7 @@ export class GoogleRecaptchaService { tap(([recaptchaVersionRD, recaptchaModeRD, recaptchaKeyRD]) => { if ( - this.cookieService.get('orejime-anonymous') && this.cookieService.get('orejime-anonymous')[CAPTCHA_NAME] && + this.cookieService.get('orejime') && this.cookieService.get('orejime')[CAPTCHA_NAME] && recaptchaKeyRD.hasSucceeded && recaptchaVersionRD.hasSucceeded && isNotEmpty(recaptchaVersionRD.payload?.values) && isNotEmpty(recaptchaKeyRD.payload?.values) ) { diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index 90841f30881..e71227f504c 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -247,7 +247,7 @@ export class RegisterEmailFormComponent implements OnDestroy, OnInit { * Return true if the user has accepted the required cookies for reCaptcha */ isRecaptchaCookieAccepted(): boolean { - const orejimeAnonymousCookie = this.cookieService.get('orejime-anonymous'); + const orejimeAnonymousCookie = this.cookieService.get('orejime'); return isNotEmpty(orejimeAnonymousCookie) ? orejimeAnonymousCookie[CAPTCHA_NAME] : false; } diff --git a/src/app/shared/cookies/orejime-configuration.ts b/src/app/shared/cookies/orejime-configuration.ts index fd275f7e77d..e995e04ef5d 100644 --- a/src/app/shared/cookies/orejime-configuration.ts +++ b/src/app/shared/cookies/orejime-configuration.ts @@ -15,7 +15,7 @@ import { NativeWindowRef } from '../../core/services/window.service'; */ export const HAS_AGREED_END_USER = 'dsHasAgreedEndUser'; -export const ANONYMOUS_STORAGE_NAME_OREJIME = 'orejime-anonymous'; +export const ANONYMOUS_STORAGE_NAME_OREJIME = 'orejime'; export const GOOGLE_ANALYTICS_OREJIME_KEY = 'google-analytics'; diff --git a/src/styles/_custom_variables.scss b/src/styles/_custom_variables.scss index 682306c636a..6bddfd58e94 100644 --- a/src/styles/_custom_variables.scss +++ b/src/styles/_custom_variables.scss @@ -148,6 +148,6 @@ --ds-process-overview-table-info-column-width: 250px; --ds-process-overview-table-actions-column-width: 80px; - --green1: #1FB300; // This variable represents the success color for the Orejime cookie banner + --green1: #1c710a; // This variable represents the success color for the Orejime cookie banner --button-text-color-cookie: #fff; // This variable represents the text color for buttons in the Orejime cookie banner } diff --git a/src/styles/_global-styles.scss b/src/styles/_global-styles.scss index 3e0e8c5f828..4934ec3d350 100644 --- a/src/styles/_global-styles.scss +++ b/src/styles/_global-styles.scss @@ -56,7 +56,7 @@ body { } a { - color: var(--green1); + color: var(--bs-white); } }