diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff027bf..a88202f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
+### [2.2.3](https://github.com/eea/volto-eea-website-policy/compare/2.2.2...2.2.3) - 19 September 2024
+
+#### :rocket: New Features
+
+- feat: Switch to Microsoft Azure Login - refs #272383 [Alin Voinea - [`95ea03e`](https://github.com/eea/volto-eea-website-policy/commit/95ea03ee01102b4c2bd3f2b642dadd4fe6bf59ee)]
+
+#### :hammer_and_wrench: Others
+
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`74f7cb1`](https://github.com/eea/volto-eea-website-policy/commit/74f7cb1b4f7dd3232f9a6c0ad35e50bc86b64e60)]
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c8978f0`](https://github.com/eea/volto-eea-website-policy/commit/c8978f02c53c38d88b654544051aa28ba5ccd05c)]
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`fb31e28`](https://github.com/eea/volto-eea-website-policy/commit/fb31e285959820147aa07e827cea25589d27be63)]
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`3b0c059`](https://github.com/eea/volto-eea-website-policy/commit/3b0c059772a0ca32f398c17b6ddb74be8e2f0060)]
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`25d16e4`](https://github.com/eea/volto-eea-website-policy/commit/25d16e401b4d2685a201a1b3a9830916ed4c5b80)]
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`d4fdfaf`](https://github.com/eea/volto-eea-website-policy/commit/d4fdfaf94d8fa962906cf713c865202bbff1ff60)]
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`742d72c`](https://github.com/eea/volto-eea-website-policy/commit/742d72c1f020fc7a2ed553dc739be54daeb2283d)]
+- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`e3dc5ef`](https://github.com/eea/volto-eea-website-policy/commit/e3dc5ef5da18aa64091388d8779dcc2819e5ad80)]
### [2.2.2](https://github.com/eea/volto-eea-website-policy/compare/2.2.1...2.2.2) - 28 August 2024
#### :bug: Bug Fixes
diff --git a/package.json b/package.json
index 28fab73..ca85d8a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-eea-website-policy",
- "version": "2.2.2",
+ "version": "2.2.3",
"description": "@eeacms/volto-eea-website-policy: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
diff --git a/src/components/AzureLogin/Login.jsx b/src/components/AzureLogin/Login.jsx
deleted file mode 100644
index 2e04df5..0000000
--- a/src/components/AzureLogin/Login.jsx
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Login container.
- * @module components/Login/Login
- */
-import React, { useEffect, useState } from 'react';
-import {
- authomaticRedirect,
- listAuthOptions,
- oidcRedirect,
-} from '@plone-collective/volto-authomatic/actions';
-import { injectIntl } from 'react-intl';
-import { useSelector, useDispatch } from 'react-redux';
-import { useLocation } from 'react-router-dom';
-import LoginForm from '@plone-collective/volto-authomatic/components/Login/LoginForm';
-import qs from 'query-string';
-import { useCookies } from 'react-cookie';
-
-/**
- * Get retur url function.
- * @function getReturnUrl
- * @param {Object} location Location object.
- * @returns {string} Return url.
- */
-function getReturnUrl(location) {
- return `${
- qs.parse(location.search).return_url ||
- (location.pathname === '/azure_login'
- ? '/'
- : location.pathname.replace('/azure_login', ''))
- }`;
-}
-
-/**
- * Login function.
- * @function Login
- * @returns {JSX.Element} Markup of the Login page.
- */
-function Login({ intl }) {
- const dispatch = useDispatch();
- const [startedOAuth, setStartedOAuth] = useState(false);
- const [startedOIDC, setStartedOIDC] = useState(false);
- const loading = useSelector((state) => state.authOptions.loading);
- const options = useSelector((state) => state.authOptions.options);
- const loginOAuthValues = useSelector((state) => state.authomaticRedirect);
- const loginOIDCValues = useSelector((state) => state.oidcRedirect);
- const location = useLocation();
- const [, setCookie] = useCookies();
-
- useEffect(() => {
- dispatch(listAuthOptions());
- }, [dispatch]);
-
- useEffect(() => {
- const next_url = loginOAuthValues.next_url;
- const session = loginOAuthValues.session;
- if (next_url && session && startedOAuth) {
- setStartedOAuth(false);
- // Give time to save state to localstorage
- setTimeout(function () {
- window.location.href = next_url;
- }, 500);
- }
- }, [startedOAuth, loginOAuthValues]);
-
- const onSelectProvider = (provider) => {
- setStartedOAuth(true);
- setCookie('return_url', getReturnUrl(location), { path: '/' });
- dispatch(authomaticRedirect(provider.id));
- };
-
- useEffect(() => {
- const next_url = loginOIDCValues.next_url;
- if (next_url && startedOIDC) {
- setStartedOIDC(false);
- // Give time to save state to localstorage
- setTimeout(function () {
- window.location.href = next_url;
- }, 500);
- }
- }, [startedOIDC, loginOIDCValues]);
-
- useEffect(() => {
- if (
- options !== undefined &&
- options.length === 1 &&
- options[0].id === 'oidc'
- ) {
- setStartedOIDC(true);
- dispatch(oidcRedirect('oidc'));
- }
- }, [options, dispatch]);
-
- return (
-
- );
-}
-
-export default injectIntl(Login);
diff --git a/src/components/AzureLogin/Login.test.jsx b/src/components/AzureLogin/Login.test.jsx
deleted file mode 100644
index daf3b0e..0000000
--- a/src/components/AzureLogin/Login.test.jsx
+++ /dev/null
@@ -1,179 +0,0 @@
-import { render, screen, fireEvent } from '@testing-library/react';
-import { Provider } from 'react-intl-redux';
-import configureStore from 'redux-mock-store';
-import { useLocation } from 'react-router-dom';
-import { listAuthOptions } from '@plone-collective/volto-authomatic/actions';
-import '@testing-library/jest-dom/extend-expect';
-
-import Login from './Login';
-
-const mockStore = configureStore();
-
-jest.mock('react-router-dom', () => ({
- ...jest.requireActual('react-router-dom'),
- useLocation: jest.fn(),
-}));
-
-jest.useFakeTimers();
-
-describe('Login component', () => {
- beforeEach(() => {
- useLocation.mockReturnValue({ pathname: '/azure_login' });
- });
-
- it('renders correctly with loading state', () => {
- const store = mockStore({
- authOptions: { loading: true, options: [] },
- authomaticRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- oidcRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- intl: {
- locale: 'en',
- messages: {},
- formatMessage: jest.fn(),
- },
- });
-
- render(
-
-
- ,
- );
-
- expect(screen.getByText('Loading')).toBeInTheDocument();
- });
-
- it('dispatches listAuthOptions on mount', () => {
- const store = mockStore({
- authOptions: { loading: true, options: [] },
- authomaticRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- oidcRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- intl: {
- locale: 'en',
- messages: {},
- formatMessage: jest.fn(),
- },
- });
- const dispatch = jest.spyOn(store, 'dispatch');
-
- render(
-
-
- ,
- );
-
- expect(dispatch).toHaveBeenCalledWith(listAuthOptions());
- });
-
- it('renders providers from the store', () => {
- const store = mockStore({
- authOptions: {
- loading: false,
- options: [
- { id: 'facebook', title: 'Facebook' },
- { id: 'twitter', title: 'Twitter' },
- ],
- },
- authomaticRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- oidcRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- intl: {
- locale: 'en',
- messages: {},
- formatMessage: jest.fn(),
- },
- });
-
- render(
-
-
- ,
- );
-
- // Assert that the provider buttons are present
- expect(
- screen.getByRole('button', { name: /Facebook/i }),
- ).toBeInTheDocument();
- expect(
- screen.getByRole('button', { name: /Twitter/i }),
- ).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('button', { name: /Facebook/i }));
- });
-
- it('clicks on GitHub button for OAuth login', () => {
- useLocation.mockReturnValue({ pathname: '/login' });
-
- const store = mockStore({
- authOptions: {
- loading: false,
- options: [{ id: 'github', title: 'GitHub' }],
- },
- authomaticRedirect: { next_url: '/dashboard', session: true },
- oidcRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- intl: {
- locale: 'en',
- messages: {},
- formatMessage: jest.fn(),
- },
- });
-
- render(
-
-
- ,
- );
-
- fireEvent.click(screen.getByRole('button', { name: /GitHub/i }));
- });
-
- it('renders correctly with loading state', () => {
- const store = mockStore({
- authOptions: {
- loading: true,
- options: [{ id: 'oidc', title: 'OIDC' }],
- },
- authomaticRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- oidcRedirect: {
- next_url: '/dashboard',
- session: true,
- },
- intl: {
- locale: 'en',
- messages: {},
- formatMessage: jest.fn(),
- },
- });
-
- render(
-
-
- ,
- );
-
- expect(screen.getByText('Loading')).toBeInTheDocument();
- jest.advanceTimersByTime(500);
- });
-});
diff --git a/src/index.js b/src/index.js
index 3e61652..2b4e019 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2,9 +2,6 @@ import { runtimeConfig } from '@plone/volto/runtime_config';
import installContextNavigationBlock from '@eeacms/volto-eea-website-policy/components/Blocks/ContextNavigation';
import { appendGroup } from './helpers';
import { FrequencyOfDissemination } from '@eeacms/volto-eea-website-policy/components/Widgets/FrequencyOfDissemination';
-import Login from '@eeacms/volto-eea-website-policy/components/AzureLogin/Login.jsx';
-import Logout from '@plone-collective/volto-authomatic/components/Logout/Logout.jsx';
-import { Login as VoltoLogin } from '@plone/volto/components';
const restrictedBlocks = [
'imagecards',
@@ -55,17 +52,6 @@ const applyConfig = (config) => {
},
];
- // #258877 Make Azure AD login to be at route /azure_login and EIONET LDAP login to be at /login
- config.addonRoutes = [
- { path: '/azure_login', component: Login },
- { path: '/**/azure_login', component: Login },
- { path: '/login', component: VoltoLogin },
- { path: '/**/login', component: VoltoLogin },
- { path: '/logout', component: Logout },
- { path: '/**/logout', component: Logout },
- ...(config.addonRoutes || []),
- ];
-
// #160689 Redirect contact-form to contact-us
config.settings.contactForm = '/en/about/contact-us';