diff --git a/front/package-lock.json b/front/package-lock.json index 87affcee8f..d376a92873 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -2995,9 +2995,9 @@ "dev": true }, "@gladysassistant/gladys-gateway-js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@gladysassistant/gladys-gateway-js/-/gladys-gateway-js-4.2.0.tgz", - "integrity": "sha512-ATkDhUnFzNpE39o/CqTvR8TzfxSn52AxiJAXXCvDJS6cp1DBQ8G1wqCjKxrV2Ef+rnYMV4Ir+YIohimnH46oJg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@gladysassistant/gladys-gateway-js/-/gladys-gateway-js-4.3.1.tgz", + "integrity": "sha512-OYqwH0jf8eSwU3cH71GOvz8txg7z3n1MjlfonKwwimIK+I3mbnPaxLYm4tkISL94KCrNB5pa5eO/UWULBmH8fQ==", "requires": { "@ctrlpanel/pbkdf2": "^1.0.0", "array-buffer-to-hex": "^1.0.0", @@ -7457,7 +7457,7 @@ "component-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", - "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + "integrity": "sha512-WZveuKPeKAG9qY+FkYDeADzdHyTYdIboXS59ixDeRJL5ZhxpqUnxSOwop4FQjMsiYm3/Or8cegVbpAHNA7pHxw==" }, "component-emitter": { "version": "1.2.1", @@ -7468,7 +7468,7 @@ "component-inherit": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", - "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + "integrity": "sha512-w+LhYREhatpVqTESyGFg3NlP6Iu0kEKUHETY9GoZP/pQyW4mHFZuFWRUCIqVPZ36ueVLtoOEZaAqbCF2RDndaA==" }, "compressible": { "version": "2.0.18", @@ -9598,9 +9598,9 @@ } }, "engine.io-client": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.2.tgz", - "integrity": "sha512-QEqIp+gJ/kMHeUun7f5Vv3bteRHppHH/FMBQX/esFj/fuYfjyUKWGMo3VCvIP/V8bE9KcjHmRZrhIz2Z9oNsDA==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.3.tgz", + "integrity": "sha512-qsgyc/CEhJ6cgMUwxRRtOndGVhIu5hpL5tR4umSpmX/MvkFoIxUTM7oFMDQumHNzlNLwSVy6qhstFPoWTf7dOw==", "requires": { "component-emitter": "~1.3.0", "component-inherit": "0.0.3", @@ -13241,7 +13241,7 @@ "has-cors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", - "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + "integrity": "sha512-g5VNKdkFuUuVCP9gYfDJHjK2nqdQJ7aDLTnycnc2+RvsOQbuLdF5pm7vuE5J76SEBIQjs4kQY/BWq74JUmjbXA==" }, "has-flag": { "version": "3.0.0", @@ -13892,7 +13892,7 @@ "indexof": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + "integrity": "sha512-i0G7hLJ1z0DE8dsqJa2rycj9dBmNKgXBvotXtZYXakU9oivfB9Uj2ZBC27qqef2U58/ZLwalxa1X/RDCdkHtVg==" }, "infer-owner": { "version": "1.0.4", @@ -15453,7 +15453,7 @@ "jsbn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", - "integrity": "sha1-sBMHyym2GKHtJux56RH4A8TaAEA=" + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" }, "jsdom": { "version": "9.12.0", @@ -18459,7 +18459,7 @@ "pad-start": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pad-start/-/pad-start-1.0.2.tgz", - "integrity": "sha1-I+W6s+lkRrYoFs/28VCXXwQNGxQ=" + "integrity": "sha512-EBN8Ez1SVRcZT1XsIE4WkdnZ5coLoaChkIgAET6gIlaLhXqCz9upVk0DQWFtOYkrpTVvbEppRUnqhTiJrBdkfw==" }, "pako": { "version": "1.0.11", @@ -22232,9 +22232,9 @@ } }, "socket.io-client": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.4.0.tgz", - "integrity": "sha512-M6xhnKQHuuZd4Ba9vltCLT9oa+YvTsP8j9NcEiLElfIg8KeYPyhWOes6x4t+LTAC8enQbE/995AdTem2uNyKKQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.5.0.tgz", + "integrity": "sha512-lOO9clmdgssDykiOmVQQitwBAF3I6mYcQAo7hQ7AM6Ny5X7fp8hIJ3HcQs3Rjz4SoggoxA1OgrQyY8EgTbcPYw==", "requires": { "backo2": "1.0.2", "component-bind": "1.0.0", @@ -23633,7 +23633,7 @@ "to-array": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", - "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + "integrity": "sha512-LhVdShQD/4Mk4zXNroIQZJC+Ap3zgLcDuwEdcmLv9CCO73NWockQDwyUnW/m8VX/EElfL6FcYx7EeutN4HJA6A==" }, "to-arraybuffer": { "version": "1.0.1", @@ -26491,7 +26491,7 @@ "yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", - "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" + "integrity": "sha512-8HFIh676uyGYP6wP13R/j6OJ/1HwJ46snpvzE7aHAN3Ryqh2yX6Xox2B4CUmTwwOIzlG3Bs7ocsP5dZH/R1Qbg==" }, "yocto-queue": { "version": "0.1.0", diff --git a/front/package.json b/front/package.json index 1c4c3a12cf..21134f1e76 100644 --- a/front/package.json +++ b/front/package.json @@ -14,6 +14,7 @@ "postbuild-with-stats": "cp ./old-sw.js ./build/sw.js", "serve": "sirv build --port 8080 --cors --single", "dev": "preact watch -p 1444 --template src/template.html", + "start-gateway": "cross-env GATEWAY_MODE=true preact watch -p 1445 --template src/template.html", "eslint": "eslint src cypress --ext .json --ext .js --ext .jsx", "compare-translations": "comparejson -e ./src/config/i18n/*.json && node ./cli/check_translations.js", "prettier-check": "prettier --check '**/*.js' '**/*.jsx' '**/*.json'", @@ -43,7 +44,7 @@ "prettier": "^1.17.1" }, "dependencies": { - "@gladysassistant/gladys-gateway-js": "^4.2.0", + "@gladysassistant/gladys-gateway-js": "^4.3.1", "@gladysassistant/theme-optimized": "^1.0.3", "@jaames/iro": "^5.5.2", "@yaireo/tagify": "^4.5.0", diff --git a/front/src/actions/main.js b/front/src/actions/main.js index afc4cbaaf9..940ca6d32f 100644 --- a/front/src/actions/main.js +++ b/front/src/actions/main.js @@ -68,14 +68,15 @@ function createActions(store) { const status = get(e, 'response.status'); const error = get(e, 'response.data.error'); const gatewayErrorMessage = get(e, 'response.data.error_message'); - if (status === 401 || status === 403) { + const errorMessageOtherFormat = get(e, 'response.data.message'); + if (status === 401) { state.session.reset(); actions.redirectToLogin(); } else if (error === 'GATEWAY_USER_NOT_LINKED') { route('/link-gateway-user'); } else if (error === 'USER_NOT_ACCEPTED_LOCALLY') { route('/link-gateway-user'); - } else if (gatewayErrorMessage === 'NO_INSTANCE_FOUND') { + } else if (gatewayErrorMessage === 'NO_INSTANCE_FOUND' || errorMessageOtherFormat === 'NO_INSTANCE_DETECTED') { route('/link-gateway-user'); } else { console.error(e); diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index 501966da9c..979715af0f 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -2167,7 +2167,7 @@ "gatewayLinkUser": { "title": "Configurer Gladys Plus", "label": "Sélectionnez votre utilisateur Gladys", - "description": "Avant de sélectionner votre utilisateur ici, vérifiez que celui-ci soit bien accepté locallement sur votre instance Gladys (dans \"Paramètres\" => \"Gladys Plus\" => \"Utilisateurs\").", + "description": "Avant de sélectionner votre utilisateur ici, vérifiez que celui-ci soit bien accepté localement sur votre instance Gladys (dans \"Paramètres\" => \"Gladys Plus\" => \"Utilisateurs\").", "noInstanceFound": "Votre instance Gladys n'est pas connectée à la passerelle Gladys. Vous êtes-vous connecté à votre compte Gladys Plus dans votre installation Gladys ?", "error": "Une erreur est survenue. Votre utilisateur est-il autorisé localement dans votre instance Gladys ?", "saveButton": "Sauvegarder",