@eeacms/volto-bise-policy 1.2.27 → 1.2.28
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,11 @@ 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.2.28](https://github.com/eea/volto-bise-policy/compare/1.2.27...1.2.28) - 3 November 2025
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Remove ldap [dobri1408 - [`d46cc11`](https://github.com/eea/volto-bise-policy/commit/d46cc11d4a6bd4c26be38e94b847cf9c1b1f0c20)]
|
|
7
12
|
### [1.2.27](https://github.com/eea/volto-bise-policy/compare/1.2.26...1.2.27) - 30 October 2025
|
|
8
13
|
|
|
9
14
|
#### :rocket: New Features
|
package/package.json
CHANGED
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Combined Login container - supports both external providers and Plone login.
|
|
3
|
-
* @module components/Login/Login
|
|
4
|
-
*/
|
|
5
|
-
import React, { useEffect, useState } from 'react';
|
|
6
|
-
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
|
|
7
|
-
import { Link, useHistory, useLocation } from 'react-router-dom';
|
|
8
|
-
import {
|
|
9
|
-
Container,
|
|
10
|
-
Button,
|
|
11
|
-
Form,
|
|
12
|
-
Input,
|
|
13
|
-
Segment,
|
|
14
|
-
Grid,
|
|
15
|
-
} from 'semantic-ui-react';
|
|
16
|
-
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
|
17
|
-
import qs from 'query-string';
|
|
18
|
-
import { useCookies } from 'react-cookie';
|
|
19
|
-
|
|
20
|
-
import { Helmet } from '@plone/volto/helpers';
|
|
21
|
-
import config from '@plone/volto/registry';
|
|
22
|
-
import { Icon } from '@plone/volto/components';
|
|
23
|
-
import { login, resetLoginRequest } from '@plone/volto/actions';
|
|
24
|
-
import { toast } from 'react-toastify';
|
|
25
|
-
import { Toast } from '@plone/volto/components';
|
|
26
|
-
import aheadSVG from '@plone/volto/icons/ahead.svg';
|
|
27
|
-
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
28
|
-
import './Login.less';
|
|
29
|
-
|
|
30
|
-
// Import authomatic components and actions
|
|
31
|
-
import {
|
|
32
|
-
authomaticRedirect,
|
|
33
|
-
listAuthOptions,
|
|
34
|
-
oidcRedirect,
|
|
35
|
-
} from '@plone-collective/volto-authomatic/actions';
|
|
36
|
-
import AuthProviders from '@plone-collective/volto-authomatic/components/AuthProviders/AuthProviders';
|
|
37
|
-
|
|
38
|
-
const messages = defineMessages({
|
|
39
|
-
login: {
|
|
40
|
-
id: 'Log in',
|
|
41
|
-
defaultMessage: 'Log in',
|
|
42
|
-
},
|
|
43
|
-
loginName: {
|
|
44
|
-
id: 'Login Name',
|
|
45
|
-
defaultMessage: 'Login Name',
|
|
46
|
-
},
|
|
47
|
-
Login: {
|
|
48
|
-
id: 'Login',
|
|
49
|
-
defaultMessage: 'Login',
|
|
50
|
-
},
|
|
51
|
-
password: {
|
|
52
|
-
id: 'Password',
|
|
53
|
-
defaultMessage: 'Password',
|
|
54
|
-
},
|
|
55
|
-
cancel: {
|
|
56
|
-
id: 'Cancel',
|
|
57
|
-
defaultMessage: 'Cancel',
|
|
58
|
-
},
|
|
59
|
-
error: {
|
|
60
|
-
id: 'Error',
|
|
61
|
-
defaultMessage: 'Error',
|
|
62
|
-
},
|
|
63
|
-
loginFailed: {
|
|
64
|
-
id: 'Login Failed',
|
|
65
|
-
defaultMessage: 'Login Failed',
|
|
66
|
-
},
|
|
67
|
-
loginFailedContent: {
|
|
68
|
-
id: 'Both email address and password are case sensitive, check that caps lock is not enabled.',
|
|
69
|
-
defaultMessage:
|
|
70
|
-
'Both email address and password are case sensitive, check that caps lock is not enabled.',
|
|
71
|
-
},
|
|
72
|
-
register: {
|
|
73
|
-
id: 'Register',
|
|
74
|
-
defaultMessage: 'Register',
|
|
75
|
-
},
|
|
76
|
-
forgotPassword: {
|
|
77
|
-
id: 'box_forgot_password_option',
|
|
78
|
-
defaultMessage: 'Forgot your password?',
|
|
79
|
-
},
|
|
80
|
-
signInWith: {
|
|
81
|
-
id: 'Sign in with EEA Microsoft Entra ID',
|
|
82
|
-
defaultMessage: 'Sign in with EEA Microsoft Entra ID',
|
|
83
|
-
},
|
|
84
|
-
orSignIn: {
|
|
85
|
-
id: 'Or sign in with EEA Entra ID:',
|
|
86
|
-
defaultMessage: 'Or sign in with EEA Entra ID:',
|
|
87
|
-
},
|
|
88
|
-
loading: {
|
|
89
|
-
id: 'Loading',
|
|
90
|
-
defaultMessage: 'Loading',
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Get return url function.
|
|
96
|
-
* @function getReturnUrl
|
|
97
|
-
* @param {Object} location Location object.
|
|
98
|
-
* @returns {string} Return url.
|
|
99
|
-
*/
|
|
100
|
-
function getReturnUrl(location) {
|
|
101
|
-
return `${
|
|
102
|
-
qs.parse(location.search).return_url ||
|
|
103
|
-
(location.pathname === '/login'
|
|
104
|
-
? '/'
|
|
105
|
-
: location.pathname.replace('/login', ''))
|
|
106
|
-
}`;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Combined Login function.
|
|
111
|
-
* @function Login
|
|
112
|
-
* @returns {JSX.Element} Markup of the Login page.
|
|
113
|
-
*/
|
|
114
|
-
function Login({ intl }) {
|
|
115
|
-
const dispatch = useDispatch();
|
|
116
|
-
const history = useHistory();
|
|
117
|
-
const location = useLocation();
|
|
118
|
-
|
|
119
|
-
// Authomatic state
|
|
120
|
-
const [startedOAuth, setStartedOAuth] = useState(false);
|
|
121
|
-
const [startedOIDC, setStartedOIDC] = useState(false);
|
|
122
|
-
const loading = useSelector((state) => state.authOptions.loading);
|
|
123
|
-
const options = useSelector((state) => state.authOptions.options);
|
|
124
|
-
const loginOAuthValues = useSelector((state) => state.authomaticRedirect);
|
|
125
|
-
const loginOIDCValues = useSelector((state) => state.oidcRedirect);
|
|
126
|
-
const [, setCookie] = useCookies();
|
|
127
|
-
|
|
128
|
-
// Plone login state
|
|
129
|
-
const token = useSelector((state) => state.userSession.token, shallowEqual);
|
|
130
|
-
const error = useSelector((state) => state.userSession.login.error);
|
|
131
|
-
const ploneLoading = useSelector((state) => state.userSession.login.loading);
|
|
132
|
-
|
|
133
|
-
const returnUrl =
|
|
134
|
-
qs.parse(location.search).return_url ||
|
|
135
|
-
location.pathname.replace(/\/login\/?$/, '').replace(/\/logout\/?$/, '') ||
|
|
136
|
-
'/';
|
|
137
|
-
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
dispatch(listAuthOptions());
|
|
140
|
-
}, [dispatch]);
|
|
141
|
-
|
|
142
|
-
// Handle successful Plone login
|
|
143
|
-
useEffect(() => {
|
|
144
|
-
if (token) {
|
|
145
|
-
history.push(returnUrl || '/');
|
|
146
|
-
if (toast.isActive('loggedOut')) {
|
|
147
|
-
toast.dismiss('loggedOut');
|
|
148
|
-
}
|
|
149
|
-
if (toast.isActive('loginFailed')) {
|
|
150
|
-
toast.dismiss('loginFailed');
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (error) {
|
|
154
|
-
if (toast.isActive('loggedOut')) {
|
|
155
|
-
toast.dismiss('loggedOut');
|
|
156
|
-
}
|
|
157
|
-
if (!toast.isActive('loginFailed')) {
|
|
158
|
-
toast.error(
|
|
159
|
-
<Toast
|
|
160
|
-
error
|
|
161
|
-
title={intl.formatMessage(messages.loginFailed)}
|
|
162
|
-
content={intl.formatMessage(messages.loginFailedContent)}
|
|
163
|
-
/>,
|
|
164
|
-
{ autoClose: false, toastId: 'loginFailed' },
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return () => {
|
|
169
|
-
if (toast.isActive('loginFailed')) {
|
|
170
|
-
toast.dismiss('loginFailed');
|
|
171
|
-
dispatch(resetLoginRequest());
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
}, [dispatch, token, error, intl, history, returnUrl]);
|
|
175
|
-
|
|
176
|
-
// Handle OAuth redirects
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
const next_url = loginOAuthValues.next_url;
|
|
179
|
-
const session = loginOAuthValues.session;
|
|
180
|
-
if (next_url && session && startedOAuth) {
|
|
181
|
-
setStartedOAuth(false);
|
|
182
|
-
// Give time to save state to localstorage
|
|
183
|
-
setTimeout(function () {
|
|
184
|
-
window.location.href = next_url;
|
|
185
|
-
}, 500);
|
|
186
|
-
}
|
|
187
|
-
}, [startedOAuth, loginOAuthValues]);
|
|
188
|
-
|
|
189
|
-
useEffect(() => {
|
|
190
|
-
const next_url = loginOIDCValues.next_url;
|
|
191
|
-
if (next_url && startedOIDC) {
|
|
192
|
-
setStartedOIDC(false);
|
|
193
|
-
// Give time to save state to localstorage
|
|
194
|
-
setTimeout(function () {
|
|
195
|
-
window.location.href = next_url;
|
|
196
|
-
}, 500);
|
|
197
|
-
}
|
|
198
|
-
}, [startedOIDC, loginOIDCValues]);
|
|
199
|
-
|
|
200
|
-
useEffect(() => {
|
|
201
|
-
if (
|
|
202
|
-
options !== undefined &&
|
|
203
|
-
options.length === 1 &&
|
|
204
|
-
options[0].id === 'oidc'
|
|
205
|
-
) {
|
|
206
|
-
setStartedOIDC(true);
|
|
207
|
-
dispatch(oidcRedirect('oidc'));
|
|
208
|
-
}
|
|
209
|
-
}, [options, dispatch]);
|
|
210
|
-
|
|
211
|
-
// Handle provider selection
|
|
212
|
-
const onSelectProvider = (provider) => {
|
|
213
|
-
setStartedOAuth(true);
|
|
214
|
-
setCookie('return_url', getReturnUrl(location), { path: '/' });
|
|
215
|
-
dispatch(authomaticRedirect(provider.id));
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
// Handle Plone login form submission
|
|
219
|
-
const onLogin = (event) => {
|
|
220
|
-
dispatch(
|
|
221
|
-
login(
|
|
222
|
-
document.getElementsByName('login')[0].value,
|
|
223
|
-
document.getElementsByName('password')[0].value,
|
|
224
|
-
),
|
|
225
|
-
);
|
|
226
|
-
event.preventDefault();
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// Prepare providers for external login
|
|
230
|
-
const validProviders = options
|
|
231
|
-
? options.filter((provider) => provider.id !== 'oidc')
|
|
232
|
-
: [];
|
|
233
|
-
|
|
234
|
-
return (
|
|
235
|
-
<div id="page-login">
|
|
236
|
-
<Helmet title={intl.formatMessage(messages.Login)} />
|
|
237
|
-
<Container text>
|
|
238
|
-
<Segment.Group raised>
|
|
239
|
-
<Segment className="primary">
|
|
240
|
-
<FormattedMessage id="Log In" defaultMessage="Login" />
|
|
241
|
-
</Segment>
|
|
242
|
-
<Segment secondary>
|
|
243
|
-
<FormattedMessage
|
|
244
|
-
id="Sign in to start session"
|
|
245
|
-
defaultMessage="Sign in to start session"
|
|
246
|
-
/>
|
|
247
|
-
</Segment>
|
|
248
|
-
|
|
249
|
-
{/* Plone Login Form */}
|
|
250
|
-
<Segment className="form">
|
|
251
|
-
<Form method="post" onSubmit={onLogin}>
|
|
252
|
-
<Form.Field inline className="help">
|
|
253
|
-
<Grid>
|
|
254
|
-
<Grid.Row stretched>
|
|
255
|
-
<Grid.Column width="4">
|
|
256
|
-
<div className="wrapper">
|
|
257
|
-
<label htmlFor="login">
|
|
258
|
-
<FormattedMessage
|
|
259
|
-
id="Login Name"
|
|
260
|
-
defaultMessage="Login Name"
|
|
261
|
-
/>
|
|
262
|
-
</label>
|
|
263
|
-
</div>
|
|
264
|
-
</Grid.Column>
|
|
265
|
-
<Grid.Column width="8">
|
|
266
|
-
<Input
|
|
267
|
-
id="login"
|
|
268
|
-
name="login"
|
|
269
|
-
placeholder={intl.formatMessage(messages.loginName)}
|
|
270
|
-
/>
|
|
271
|
-
</Grid.Column>
|
|
272
|
-
</Grid.Row>
|
|
273
|
-
</Grid>
|
|
274
|
-
</Form.Field>
|
|
275
|
-
<Form.Field inline className="help">
|
|
276
|
-
<Grid>
|
|
277
|
-
<Grid.Row stretched>
|
|
278
|
-
<Grid.Column stretched width="4">
|
|
279
|
-
<div className="wrapper">
|
|
280
|
-
<label htmlFor="password">
|
|
281
|
-
<FormattedMessage
|
|
282
|
-
id="Password"
|
|
283
|
-
defaultMessage="Password"
|
|
284
|
-
/>
|
|
285
|
-
</label>
|
|
286
|
-
</div>
|
|
287
|
-
</Grid.Column>
|
|
288
|
-
<Grid.Column stretched width="8">
|
|
289
|
-
<Input
|
|
290
|
-
type="password"
|
|
291
|
-
id="password"
|
|
292
|
-
autoComplete="current-password"
|
|
293
|
-
name="password"
|
|
294
|
-
placeholder={intl.formatMessage(messages.password)}
|
|
295
|
-
tabIndex={0}
|
|
296
|
-
/>
|
|
297
|
-
</Grid.Column>
|
|
298
|
-
</Grid.Row>
|
|
299
|
-
</Grid>
|
|
300
|
-
</Form.Field>
|
|
301
|
-
<Form.Field inline className="help">
|
|
302
|
-
<Grid>
|
|
303
|
-
<Grid.Row stretched>
|
|
304
|
-
{config.settings.showSelfRegistration && (
|
|
305
|
-
<Grid.Column stretched width="12">
|
|
306
|
-
<p className="help">
|
|
307
|
-
<Link to="/register">
|
|
308
|
-
{intl.formatMessage(messages.register)}
|
|
309
|
-
</Link>
|
|
310
|
-
</p>
|
|
311
|
-
</Grid.Column>
|
|
312
|
-
)}
|
|
313
|
-
<Grid.Column stretched width="12">
|
|
314
|
-
<p className="help">
|
|
315
|
-
<Link to="/passwordreset">
|
|
316
|
-
{intl.formatMessage(messages.forgotPassword)}
|
|
317
|
-
</Link>
|
|
318
|
-
</p>
|
|
319
|
-
</Grid.Column>
|
|
320
|
-
</Grid.Row>
|
|
321
|
-
</Grid>
|
|
322
|
-
</Form.Field>
|
|
323
|
-
</Form>
|
|
324
|
-
</Segment>
|
|
325
|
-
|
|
326
|
-
<Segment className="actions" clearing>
|
|
327
|
-
<Button
|
|
328
|
-
basic
|
|
329
|
-
primary
|
|
330
|
-
icon
|
|
331
|
-
floated="right"
|
|
332
|
-
type="submit"
|
|
333
|
-
form="login-form"
|
|
334
|
-
id="login-form-submit"
|
|
335
|
-
aria-label={intl.formatMessage(messages.login)}
|
|
336
|
-
title={intl.formatMessage(messages.login)}
|
|
337
|
-
loading={ploneLoading}
|
|
338
|
-
onClick={onLogin}
|
|
339
|
-
>
|
|
340
|
-
<Icon className="circled" name={aheadSVG} size="30px" />
|
|
341
|
-
</Button>
|
|
342
|
-
|
|
343
|
-
<Button
|
|
344
|
-
basic
|
|
345
|
-
secondary
|
|
346
|
-
icon
|
|
347
|
-
floated="right"
|
|
348
|
-
id="login-form-cancel"
|
|
349
|
-
as={Link}
|
|
350
|
-
to="/"
|
|
351
|
-
aria-label={intl.formatMessage(messages.cancel)}
|
|
352
|
-
title={intl.formatMessage(messages.cancel)}
|
|
353
|
-
>
|
|
354
|
-
<Icon className="circled" name={clearSVG} size="30px" />
|
|
355
|
-
</Button>
|
|
356
|
-
</Segment>
|
|
357
|
-
</Segment.Group>
|
|
358
|
-
|
|
359
|
-
{/* External Login Providers - Outside the main form */}
|
|
360
|
-
{validProviders && validProviders.length > 0 && (
|
|
361
|
-
<div style={{ marginTop: '2rem', width: '100%' }}>
|
|
362
|
-
<div style={{ textAlign: 'center', marginBottom: '1rem' }}>
|
|
363
|
-
<FormattedMessage
|
|
364
|
-
id="Or sign in with EEA Entra ID:"
|
|
365
|
-
defaultMessage="Or sign in with EEA Entra ID:"
|
|
366
|
-
/>
|
|
367
|
-
</div>
|
|
368
|
-
<div style={{ width: '100%' }}>
|
|
369
|
-
{!loading && validProviders && (
|
|
370
|
-
<AuthProviders
|
|
371
|
-
providers={validProviders}
|
|
372
|
-
action="login"
|
|
373
|
-
onSelectProvider={onSelectProvider}
|
|
374
|
-
/>
|
|
375
|
-
)}
|
|
376
|
-
{(loading || validProviders.length === 0) && (
|
|
377
|
-
<div style={{ textAlign: 'center', padding: '1rem' }}>
|
|
378
|
-
{intl.formatMessage(messages.loading)}
|
|
379
|
-
</div>
|
|
380
|
-
)}
|
|
381
|
-
</div>
|
|
382
|
-
</div>
|
|
383
|
-
)}
|
|
384
|
-
</Container>
|
|
385
|
-
</div>
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
export default injectIntl(Login);
|
|
File without changes
|