@eeacms/volto-clms-theme 1.1.293 → 1.1.295

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [1.1.295](https://github.com/eea/volto-clms-theme/compare/1.1.294...1.1.295) - 8 June 2026
8
+
9
+ #### :house: Internal changes
10
+
11
+ - style: Automated code fix [eea-jenkins - [`cb21bf3`](https://github.com/eea/volto-clms-theme/commit/cb21bf3e1891a59fce5e8cbd2bd2185ba67cae03)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - fix routing [Dobricean Ioan Dorian - [`a640f1f`](https://github.com/eea/volto-clms-theme/commit/a640f1f55e682d2f6b5a007df8e12aa4283d27b1)]
16
+ ### [1.1.294](https://github.com/eea/volto-clms-theme/compare/1.1.293...1.1.294) - 5 June 2026
17
+
18
+ #### :hammer_and_wrench: Others
19
+
20
+ - Fix redirect [Dobricean Ioan Dorian - [`18dc53d`](https://github.com/eea/volto-clms-theme/commit/18dc53d5b4fde69cf2ce95013ce7624b8dcb156d)]
7
21
  ### [1.1.293](https://github.com/eea/volto-clms-theme/compare/1.1.292...1.1.293) - 5 June 2026
8
22
 
9
23
  #### :house: Internal changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.293",
3
+ "version": "1.1.295",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -14,7 +14,6 @@ import {
14
14
  Grid,
15
15
  } from 'semantic-ui-react';
16
16
  import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
17
- import qs from 'query-string';
18
17
  import { useCookies } from 'react-cookie';
19
18
 
20
19
  import { Helmet } from '@plone/volto/helpers';
@@ -34,6 +33,7 @@ import {
34
33
  oidcRedirect,
35
34
  } from '@plone-collective/volto-authomatic/actions';
36
35
  import AuthProviders from '@plone-collective/volto-authomatic/components/AuthProviders/AuthProviders';
36
+ import { getReturnUrl } from './loginUrl';
37
37
 
38
38
  const messages = defineMessages({
39
39
  login: {
@@ -92,21 +92,6 @@ const messages = defineMessages({
92
92
  },
93
93
  });
94
94
 
95
- /**
96
- * Get return url function.
97
- * @function getReturnUrl
98
- * @param {Object} location Location object.
99
- * @returns {string} Return url.
100
- */
101
- function getReturnUrl(location) {
102
- return `${
103
- qs.parse(location.search).return_url ||
104
- (location.pathname === '/login'
105
- ? '/'
106
- : location.pathname.replace('/login', ''))
107
- }`;
108
- }
109
-
110
95
  /**
111
96
  * Combined Login function.
112
97
  * @function Login
@@ -131,10 +116,7 @@ function Login({ intl }) {
131
116
  const error = useSelector((state) => state.userSession.login.error);
132
117
  const ploneLoading = useSelector((state) => state.userSession.login.loading);
133
118
 
134
- const returnUrl =
135
- qs.parse(location.search).return_url ||
136
- location.pathname.replace(/\/login\/?$/, '').replace(/\/logout\/?$/, '') ||
137
- '/';
119
+ const returnUrl = getReturnUrl(location);
138
120
 
139
121
  useEffect(() => {
140
122
  dispatch(listAuthOptions());
@@ -0,0 +1,9 @@
1
+ import qs from 'query-string';
2
+
3
+ export function getReturnUrl(location) {
4
+ return (
5
+ qs.parse(location.search || '').return_url ||
6
+ (location.pathname || '/').replace(/\/(?:login|login-plone)\/?$/, '') ||
7
+ '/'
8
+ );
9
+ }
package/src/index.js CHANGED
@@ -53,6 +53,7 @@ import reducers from './reducers';
53
53
  import CookieBanner from 'volto-cookie-banner/CookieBannerContainer';
54
54
  import CLMSLoginView from './components/CLMSLoginView/CLMSLogin';
55
55
  import AuthomaticLoginPlone from './components/CLMSLoginView/AuthomaticLoginPlone';
56
+ import { withCLMSLoginRoutes } from './loginRoutes';
56
57
  //SLATE CONFIGURATION
57
58
  import installLinkEditor from '@plone/volto-slate/editor/plugins/AdvancedLink';
58
59
 
@@ -271,23 +272,11 @@ const applyConfig = (config) => {
271
272
  );
272
273
 
273
274
  config.addonRoutes = [
274
- ...config.addonRoutes,
275
- {
276
- path: '/login-plone',
277
- component: AuthomaticLoginPlone,
278
- },
279
- {
280
- path: '/**/login-plone',
281
- component: AuthomaticLoginPlone,
282
- },
283
- {
284
- path: '/login',
285
- component: CLMSLoginView,
286
- },
287
- {
288
- path: '/**/login',
289
- component: CLMSLoginView,
290
- },
275
+ ...withCLMSLoginRoutes(
276
+ config.addonRoutes,
277
+ CLMSLoginView,
278
+ AuthomaticLoginPlone,
279
+ ),
291
280
  {
292
281
  path: '/profile',
293
282
  component: ProfileView,
@@ -0,0 +1,35 @@
1
+ const clmsLoginPaths = [
2
+ '/login',
3
+ '/**/login',
4
+ '/login-plone',
5
+ '/**/login-plone',
6
+ ];
7
+
8
+ const routeHasCLMSLoginPath = (route) => {
9
+ const paths = Array.isArray(route.path) ? route.path : [route.path];
10
+ return paths.some((path) => clmsLoginPaths.includes(path));
11
+ };
12
+
13
+ export const buildLoginRoutes = (Login, LoginPlone) => [
14
+ {
15
+ path: '/login',
16
+ component: Login,
17
+ },
18
+ {
19
+ path: '/**/login',
20
+ component: Login,
21
+ },
22
+ {
23
+ path: '/login-plone',
24
+ component: LoginPlone,
25
+ },
26
+ {
27
+ path: '/**/login-plone',
28
+ component: LoginPlone,
29
+ },
30
+ ];
31
+
32
+ export const withCLMSLoginRoutes = (addonRoutes, Login, LoginPlone) => [
33
+ ...buildLoginRoutes(Login, LoginPlone),
34
+ ...(addonRoutes || []).filter((route) => !routeHasCLMSLoginPath(route)),
35
+ ];