diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11b03ac..524ac35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,19 +9,19 @@ jobs: install: runs-on: ubuntu-latest steps: - - name: Use Node.js 14C - uses: actions/setup-node@v1 + - name: Use Node.js 18 + uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - run: yarn --frozen-lockfile build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14 - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - name: Use Node.js 18 + uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - name: script download and install access-content run: | chmod +x ./scripts/getContent.sh @@ -33,7 +33,7 @@ jobs: - run: yarn run test - run: yarn build - name: Upload build - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: build path: build diff --git a/.github/workflows/develop-release.yml b/.github/workflows/develop-release.yml index 2cc6dd4..de6b3f1 100644 --- a/.github/workflows/develop-release.yml +++ b/.github/workflows/develop-release.yml @@ -11,19 +11,19 @@ jobs: install: runs-on: ubuntu-latest steps: - - name: Use Node.js 14C - uses: actions/setup-node@v1 + - name: Use Node.js 18 + uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - run: yarn --frozen-lockfile build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14 - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - name: Use Node.js 18 + uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - name: script download and install access-content run: | chmod +x ./scripts/getContent.sh @@ -34,7 +34,7 @@ jobs: - run: yarn - run: yarn build - name: Upload build - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: build path: build @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout current branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get current version id: version uses: notiz-dev/github-action-json-property@release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1eea42..11d5272 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,19 +11,19 @@ jobs: install: runs-on: ubuntu-latest steps: - - name: Use Node.js 14C - uses: actions/setup-node@v1 + - name: Use Node.js 18 + uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - run: yarn --frozen-lockfile build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14 - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - name: Use Node.js 18 + uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - name: script download and install access-content run: | chmod +x ./scripts/getContent.sh @@ -34,7 +34,7 @@ jobs: - run: yarn - run: yarn build - name: Upload build - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: build path: build @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout current branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get current version id: version uses: notiz-dev/github-action-json-property@release @@ -64,10 +64,10 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Download build id: download - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: build path: build diff --git a/.gitignore b/.gitignore index 1c85570..c367d5b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,3 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -yarn.lock* diff --git a/Dockerfile b/Dockerfile index 7701558..5724bdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx +FROM nginx:stable-alpine COPY build /usr/share/nginx/html RUN rm etc/nginx/conf.d/default.conf COPY nginx-coleman-promotion.conf etc/nginx/conf.d/ diff --git a/package.json b/package.json index d2a50bb..f87dcca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "colempub", - "version": "1.0.2", + "version": "1.0.10", "dependencies": { "axios": "^0.19.2", "bootstrap": "^3.3.7", @@ -22,7 +22,7 @@ }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build", + "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/src/components/auth/component.js b/src/components/auth/component.js index 4ca4121..d3e60f8 100644 --- a/src/components/auth/component.js +++ b/src/components/auth/component.js @@ -7,11 +7,13 @@ import { getSurveyVerifMailById } from 'utils/read-content'; import { getQuestionnaireUrl } from 'utils/api'; import useAuth from 'utils/hook/auth'; import NoSurveyPage from 'components/content/ineligible'; +import UnauthorizedPage from 'components/content/unauthorized'; const Auth = ({ urlBackEnd, id, history, keycloakAuth }) => { const { loading, authenticated, authError } = useAuth(keycloakAuth); const [error, setError] = useState(null); const [ineligible, setIneligible] = useState(false); + const [unauthorized, setUnauthorized] = useState(false); const redirectToUrl = url => { window.location = url; @@ -35,8 +37,11 @@ const Auth = ({ urlBackEnd, id, history, keycloakAuth }) => { setIneligible(true); } } catch (e) { - // including 410 status - no habilitation found - setError('technique'); + if (e.response.status === 401 || e.response.status === 403 || e.response.status === 404) { + setUnauthorized(true); + } else { + setError('technique'); + } } }, [history, id, urlBackEnd, keycloakAuth]); @@ -50,6 +55,7 @@ const Auth = ({ urlBackEnd, id, history, keycloakAuth }) => { {loading && } {error && } {ineligible && } + {unauthorized && } ); }; diff --git a/src/components/content/faq/component.js b/src/components/content/faq/component.js index cb39307..a3553b1 100644 --- a/src/components/content/faq/component.js +++ b/src/components/content/faq/component.js @@ -31,9 +31,11 @@ class Faq extends Component { const { itemDisplayed } = this.state; return (
-

{`Questions générales`}

+ {faqData.filter(f => f.type === 'general' && f.body !== undefined).length > 0 && ( +

{`Questions générales`}

+ )} {faqData.map(({ id, title, body, type }) => - type === 'general' ? ( + type === 'general' && body !== undefined ? ( { + return ( + <> +
+
+

+ + {` En cas de difficultés, vous pouvez `} + {`contacter l'assistance`} +

+
+
+ + ); +}; + +export default UnauthorizedPage; +UnauthorizedPage.propTypes = { + id: PropTypes.string.isRequired, +}; diff --git a/src/components/forms/assistance-form.js b/src/components/forms/assistance-form.js index 03f40bd..164309a 100644 --- a/src/components/forms/assistance-form.js +++ b/src/components/forms/assistance-form.js @@ -146,6 +146,7 @@ class AssistanceForm extends React.Component { const formData = { auth, idue: auth ? params.get('idue') : '', + questioningId: auth ? params.get('questioningId') : '', name: formControls.name.value, idec: formControls.idec.value, phonenumber: formControls.phonenumber.value, diff --git a/src/components/home.js b/src/components/home.js index 8f18009..8686ca2 100644 --- a/src/components/home.js +++ b/src/components/home.js @@ -6,7 +6,7 @@ import SurveyItem from 'components/template/survey-item'; const Home = () => (
- +
diff --git a/src/components/template/response-button.js b/src/components/template/response-button.js index 9436346..83c404b 100644 --- a/src/components/template/response-button.js +++ b/src/components/template/response-button.js @@ -14,7 +14,7 @@ const ResponseButton = ({ id }) => (