@gridsuite/commons-ui 0.27.2 → 0.28.0
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/lib/components/AuthenticationRouter/AuthenticationRouter.js +32 -15
- package/lib/components/Login/Logout.js +102 -0
- package/lib/components/translations/login-en.js +4 -0
- package/lib/components/translations/login-fr.js +4 -0
- package/lib/index.js +3 -1
- package/lib/utils/AuthService.js +30 -15
- package/lib/utils/actions.js +34 -3
- package/package.json +1 -1
|
@@ -15,6 +15,8 @@ var _SilentRenewCallbackHandler = _interopRequireDefault(require("../SilentRenew
|
|
|
15
15
|
|
|
16
16
|
var _Login = _interopRequireDefault(require("../Login"));
|
|
17
17
|
|
|
18
|
+
var _Logout = _interopRequireDefault(require("../Login/Logout"));
|
|
19
|
+
|
|
18
20
|
var _material = require("@mui/material");
|
|
19
21
|
|
|
20
22
|
var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
|
|
@@ -23,8 +25,6 @@ var _AlertTitle = _interopRequireDefault(require("@mui/material/AlertTitle"));
|
|
|
23
25
|
|
|
24
26
|
var _reactIntl = require("react-intl");
|
|
25
27
|
|
|
26
|
-
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
27
|
-
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
29
|
|
|
30
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -40,7 +40,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
40
40
|
var AuthenticationRouter = function AuthenticationRouter(_ref) {
|
|
41
41
|
var userManager = _ref.userManager,
|
|
42
42
|
signInCallbackError = _ref.signInCallbackError,
|
|
43
|
-
|
|
43
|
+
authenticationRouterError = _ref.authenticationRouterError,
|
|
44
44
|
showAuthenticationRouterLogin = _ref.showAuthenticationRouterLogin,
|
|
45
45
|
dispatch = _ref.dispatch,
|
|
46
46
|
navigate = _ref.navigate,
|
|
@@ -75,31 +75,48 @@ var AuthenticationRouter = function AuthenticationRouter(_ref) {
|
|
|
75
75
|
})
|
|
76
76
|
}), /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Route, {
|
|
77
77
|
path: "*",
|
|
78
|
-
element: showAuthenticationRouterLogin && /*#__PURE__*/_react["default"].createElement(_Login["default"], {
|
|
78
|
+
element: showAuthenticationRouterLogin && authenticationRouterError == null && /*#__PURE__*/_react["default"].createElement(_Login["default"], {
|
|
79
79
|
disabled: userManager.instance === null,
|
|
80
80
|
onLoginClick: function onLoginClick() {
|
|
81
81
|
return (0, _AuthService.login)(location, userManager.instance);
|
|
82
82
|
}
|
|
83
83
|
})
|
|
84
|
-
})),
|
|
84
|
+
})), authenticationRouterError !== null && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
85
85
|
item: true
|
|
86
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
(0, _AuthService.logout)(
|
|
86
|
+
}, /*#__PURE__*/_react["default"].createElement(_Logout["default"], {
|
|
87
|
+
disabled: userManager.instance === null,
|
|
88
|
+
onLogoutClick: function onLogoutClick() {
|
|
89
|
+
return (0, _AuthService.logout)(location, userManager.instance);
|
|
90
90
|
}
|
|
91
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
})), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
92
|
+
item: true,
|
|
93
|
+
xs: 4
|
|
94
|
+
}, authenticationRouterError.logoutError != null && /*#__PURE__*/_react["default"].createElement(_Alert["default"], {
|
|
95
|
+
severity: "error"
|
|
96
|
+
}, /*#__PURE__*/_react["default"].createElement(_AlertTitle["default"], null, /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
97
|
+
id: "login/errorInLogout"
|
|
98
|
+
})), /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
99
|
+
id: "login/errorInLogoutMessage",
|
|
100
|
+
values: {
|
|
101
|
+
userName: authenticationRouterError.userName
|
|
102
|
+
}
|
|
103
|
+
}), /*#__PURE__*/_react["default"].createElement("p", null, authenticationRouterError.logoutError.error.message)), (authenticationRouterError === null || authenticationRouterError === void 0 ? void 0 : authenticationRouterError.userValidationError) != null && /*#__PURE__*/_react["default"].createElement(_Alert["default"], {
|
|
104
|
+
severity: "error"
|
|
105
|
+
}, /*#__PURE__*/_react["default"].createElement(_AlertTitle["default"], null, /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
106
|
+
id: "login/errorInUserValidation"
|
|
107
|
+
})), /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
108
|
+
id: "login/errorInUserValidationMessage",
|
|
109
|
+
values: {
|
|
110
|
+
userName: authenticationRouterError.userName
|
|
111
|
+
}
|
|
112
|
+
}), /*#__PURE__*/_react["default"].createElement("p", null, authenticationRouterError.userValidationError.error.message)), (authenticationRouterError === null || authenticationRouterError === void 0 ? void 0 : authenticationRouterError.unauthorizedUserInfo) != null && /*#__PURE__*/_react["default"].createElement(_Alert["default"], {
|
|
96
113
|
severity: "info"
|
|
97
114
|
}, /*#__PURE__*/_react["default"].createElement(_AlertTitle["default"], null, /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
98
115
|
id: "login/unauthorizedAccess"
|
|
99
116
|
})), /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
100
117
|
id: "login/unauthorizedAccessMessage",
|
|
101
118
|
values: {
|
|
102
|
-
userName:
|
|
119
|
+
userName: authenticationRouterError.userName
|
|
103
120
|
}
|
|
104
121
|
}))))));
|
|
105
122
|
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _Avatar = _interopRequireDefault(require("@mui/material/Avatar"));
|
|
9
|
+
|
|
10
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
11
|
+
|
|
12
|
+
var _Link = _interopRequireDefault(require("@mui/material/Link"));
|
|
13
|
+
|
|
14
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
15
|
+
|
|
16
|
+
var _LogoutOutlined = _interopRequireDefault(require("@mui/icons-material/LogoutOutlined"));
|
|
17
|
+
|
|
18
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
19
|
+
|
|
20
|
+
var _makeStyles = _interopRequireDefault(require("@mui/styles/makeStyles"));
|
|
21
|
+
|
|
22
|
+
var _Container = _interopRequireDefault(require("@mui/material/Container"));
|
|
23
|
+
|
|
24
|
+
var _reactIntl = require("react-intl");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
30
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
31
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
32
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
33
|
+
*/
|
|
34
|
+
var useStyles = (0, _makeStyles["default"])(function (theme) {
|
|
35
|
+
return {
|
|
36
|
+
paper: {
|
|
37
|
+
marginTop: theme.spacing(8),
|
|
38
|
+
display: 'flex',
|
|
39
|
+
flexDirection: 'column',
|
|
40
|
+
alignItems: 'center'
|
|
41
|
+
},
|
|
42
|
+
avatar: {
|
|
43
|
+
margin: theme.spacing(1),
|
|
44
|
+
backgroundColor: theme.palette.error.main
|
|
45
|
+
},
|
|
46
|
+
submit: {
|
|
47
|
+
margin: theme.spacing(3, 0, 2),
|
|
48
|
+
borderRadius: '30px'
|
|
49
|
+
},
|
|
50
|
+
logo: {
|
|
51
|
+
width: 64,
|
|
52
|
+
height: 64
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
var Logout = function Logout(_ref) {
|
|
58
|
+
var onLogoutClick = _ref.onLogoutClick,
|
|
59
|
+
disabled = _ref.disabled;
|
|
60
|
+
var classes = useStyles();
|
|
61
|
+
|
|
62
|
+
function Copyright() {
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
64
|
+
variant: "body2",
|
|
65
|
+
color: "textSecondary",
|
|
66
|
+
align: "center"
|
|
67
|
+
}, 'Copyright © ', /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
68
|
+
color: "inherit",
|
|
69
|
+
href: "#"
|
|
70
|
+
}, "GridSuite"), ' ', new Date().getFullYear(), '.');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return /*#__PURE__*/_react["default"].createElement(_Container["default"], {
|
|
74
|
+
component: "main",
|
|
75
|
+
maxWidth: "xs"
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
77
|
+
className: classes.paper
|
|
78
|
+
}, /*#__PURE__*/_react["default"].createElement(_Avatar["default"], {
|
|
79
|
+
className: classes.avatar
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement(_LogoutOutlined["default"], null)), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
81
|
+
component: "h1",
|
|
82
|
+
variant: "h5"
|
|
83
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
84
|
+
id: "login/logout",
|
|
85
|
+
defaultMessage: 'logout'
|
|
86
|
+
}), ' ', "?"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
fullWidth: true,
|
|
89
|
+
variant: "contained",
|
|
90
|
+
className: classes.submit,
|
|
91
|
+
onClick: onLogoutClick
|
|
92
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
93
|
+
id: "login/logout",
|
|
94
|
+
defaultMessage: 'logout'
|
|
95
|
+
}))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
96
|
+
mt: 2
|
|
97
|
+
}, /*#__PURE__*/_react["default"].createElement(Copyright, null)));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var _default = Logout;
|
|
101
|
+
exports["default"] = _default;
|
|
102
|
+
module.exports = exports.default;
|
|
@@ -14,6 +14,10 @@ var login_en = {
|
|
|
14
14
|
'login/connection': 'Connection',
|
|
15
15
|
'login/unauthorizedAccess': 'Unauthorized access',
|
|
16
16
|
'login/unauthorizedAccessMessage': "The user {userName} isn't granted yet",
|
|
17
|
+
'login/errorInUserValidation': 'Error during user validation',
|
|
18
|
+
'login/errorInUserValidationMessage': 'An unexpected error occured during user validation for {userName}.',
|
|
19
|
+
'login/errorInLogout': 'Error during user logout',
|
|
20
|
+
'login/errorInLogoutMessage': 'An unexpected error occured during user logout for {userName}.',
|
|
17
21
|
'login/logout': 'Logout'
|
|
18
22
|
};
|
|
19
23
|
var _default = login_en;
|
|
@@ -14,6 +14,10 @@ var login_fr = {
|
|
|
14
14
|
'login/connection': 'Connexion',
|
|
15
15
|
'login/unauthorizedAccess': 'Accès non autorisé',
|
|
16
16
|
'login/unauthorizedAccessMessage': "L'utilisateur {userName} n'a pas encore accès à GridSuite",
|
|
17
|
+
'login/errorInUserValidation': "Erreur lors de la validation de l'utilisateur",
|
|
18
|
+
'login/errorInUserValidationMessage': "Une erreur s'est produite pendant la validation de l'utilisateur {userName}.",
|
|
19
|
+
'login/errorInLogout': "Erreur lors de la déconnexion de l'utilisateur",
|
|
20
|
+
'login/errorInLogoutMessage': "Une erreur s'est produite pendant la déconnexion de l'utilisateur {userName}.",
|
|
17
21
|
'login/logout': 'Se déconnecter'
|
|
18
22
|
};
|
|
19
23
|
var _default = login_fr;
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.useImportExportParams = exports.treeview_finder_fr = exports.treeview_finder_en = exports.top_bar_fr = exports.top_bar_en = exports.table_fr = exports.table_en = exports.setSignInCallbackError = exports.setShowAuthenticationRouterLogin = exports.setLoggedUser = exports.report_viewer_fr = exports.report_viewer_en = exports.logout = exports.login_fr = exports.login_en = exports.initializeAuthenticationProd = exports.initializeAuthenticationDev = exports.getPreLoginPath = exports.getFileIcon = exports.getEquipmentsInfosForSearchBar = exports.equipment_search_fr = exports.equipment_search_en = exports.equipmentStyles = exports.element_search_fr = exports.element_search_en = exports.elementType = exports.dispatchUser = exports.card_error_boundary_fr = exports.card_error_boundary_en = exports.USER = exports.UNAUTHORIZED_USER_INFO = exports.TreeViewFinder = exports.TopBar = exports.TagRenderer = exports.SnackbarProvider = exports.SIGNIN_CALLBACK_ERROR = exports.SHOW_AUTH_INFO_LOGIN = exports.ReportViewerDialog = exports.ReportViewer = exports.OverflowableText = exports.MuiVirtualizedTable = exports.LIGHT_THEME = exports.LANG_SYSTEM = exports.LANG_FRENCH = exports.LANG_ENGLISH = exports.EquipmentItem = exports.ElementSearchDialog = exports.EQUIPMENT_TYPE = exports.DEFAULT_ROW_HEIGHT = exports.DEFAULT_HEADER_HEIGHT = exports.DEFAULT_CELL_PADDING = exports.DARK_THEME = exports.CardErrorBoundary = exports.AuthenticationRouter = void 0;
|
|
4
|
+
exports.useImportExportParams = exports.treeview_finder_fr = exports.treeview_finder_en = exports.top_bar_fr = exports.top_bar_en = exports.table_fr = exports.table_en = exports.setSignInCallbackError = exports.setShowAuthenticationRouterLogin = exports.setLoggedUser = exports.report_viewer_fr = exports.report_viewer_en = exports.logout = exports.login_fr = exports.login_en = exports.initializeAuthenticationProd = exports.initializeAuthenticationDev = exports.getPreLoginPath = exports.getFileIcon = exports.getEquipmentsInfosForSearchBar = exports.equipment_search_fr = exports.equipment_search_en = exports.equipmentStyles = exports.element_search_fr = exports.element_search_en = exports.elementType = exports.dispatchUser = exports.card_error_boundary_fr = exports.card_error_boundary_en = exports.USER_VALIDATION_ERROR = exports.USER = exports.UNAUTHORIZED_USER_INFO = exports.TreeViewFinder = exports.TopBar = exports.TagRenderer = exports.SnackbarProvider = exports.SIGNIN_CALLBACK_ERROR = exports.SHOW_AUTH_INFO_LOGIN = exports.ReportViewerDialog = exports.ReportViewer = exports.OverflowableText = exports.MuiVirtualizedTable = exports.LOGOUT_ERROR = exports.LIGHT_THEME = exports.LANG_SYSTEM = exports.LANG_FRENCH = exports.LANG_ENGLISH = exports.EquipmentItem = exports.ElementSearchDialog = exports.EQUIPMENT_TYPE = exports.DEFAULT_ROW_HEIGHT = exports.DEFAULT_HEADER_HEIGHT = exports.DEFAULT_CELL_PADDING = exports.DARK_THEME = exports.CardErrorBoundary = exports.AuthenticationRouter = void 0;
|
|
5
5
|
|
|
6
6
|
var _TreeViewFinder = _interopRequireDefault(require("./components/TreeViewFinder"));
|
|
7
7
|
|
|
@@ -80,6 +80,8 @@ exports.setLoggedUser = _actions.setLoggedUser;
|
|
|
80
80
|
exports.SIGNIN_CALLBACK_ERROR = _actions.SIGNIN_CALLBACK_ERROR;
|
|
81
81
|
exports.setSignInCallbackError = _actions.setSignInCallbackError;
|
|
82
82
|
exports.UNAUTHORIZED_USER_INFO = _actions.UNAUTHORIZED_USER_INFO;
|
|
83
|
+
exports.LOGOUT_ERROR = _actions.LOGOUT_ERROR;
|
|
84
|
+
exports.USER_VALIDATION_ERROR = _actions.USER_VALIDATION_ERROR;
|
|
83
85
|
exports.setShowAuthenticationRouterLogin = _actions.setShowAuthenticationRouterLogin;
|
|
84
86
|
exports.SHOW_AUTH_INFO_LOGIN = _actions.SHOW_AUTH_INFO_LOGIN;
|
|
85
87
|
|
package/lib/utils/AuthService.js
CHANGED
|
@@ -132,15 +132,29 @@ function login(location, userManagerInstance) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
function logout(dispatch, userManagerInstance) {
|
|
135
|
-
dispatch((0, _actions.setLoggedUser)(null));
|
|
136
135
|
sessionStorage.removeItem(hackauthoritykey); //To remove when hack is removed
|
|
137
136
|
|
|
138
|
-
return userManagerInstance.
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
return userManagerInstance.getUser().then(function (user) {
|
|
138
|
+
if (user) {
|
|
139
|
+
return userManagerInstance.signoutRedirect({
|
|
140
|
+
extraQueryParams: {
|
|
141
|
+
TargetResource: userManagerInstance.settings.post_logout_redirect_uri
|
|
142
|
+
}
|
|
143
|
+
}).then(function () {
|
|
144
|
+
console.debug('logged out, window is closing...');
|
|
145
|
+
})["catch"](function (e) {
|
|
146
|
+
var _user$profile;
|
|
147
|
+
|
|
148
|
+
console.log('Error during logout :', e); // An error occured, window may not be closed, reset the user state
|
|
149
|
+
|
|
150
|
+
dispatch((0, _actions.setLoggedUser)(null));
|
|
151
|
+
dispatch((0, _actions.setLogoutError)(user === null || user === void 0 ? void 0 : (_user$profile = user.profile) === null || _user$profile === void 0 ? void 0 : _user$profile.name, {
|
|
152
|
+
error: e
|
|
153
|
+
}));
|
|
154
|
+
});
|
|
155
|
+
} else {
|
|
156
|
+
console.log('Error nobody to logout ');
|
|
141
157
|
}
|
|
142
|
-
}).then(function () {
|
|
143
|
-
return console.debug('logged out');
|
|
144
158
|
});
|
|
145
159
|
}
|
|
146
160
|
|
|
@@ -151,12 +165,10 @@ function dispatchUser(dispatch, userManagerInstance, validateUser) {
|
|
|
151
165
|
var validateUserPromise = validateUser && validateUser(user) || Promise.resolve(true);
|
|
152
166
|
return validateUserPromise.then(function (valid) {
|
|
153
167
|
if (!valid) {
|
|
154
|
-
var _user$
|
|
168
|
+
var _user$profile2;
|
|
155
169
|
|
|
156
170
|
console.debug("User isn't authorized to log in and will not be dispatched");
|
|
157
|
-
return dispatch((0, _actions.setUnauthorizedUserInfo)({
|
|
158
|
-
userName: user === null || user === void 0 ? void 0 : (_user$profile = user.profile) === null || _user$profile === void 0 ? void 0 : _user$profile.name
|
|
159
|
-
}));
|
|
171
|
+
return dispatch((0, _actions.setUnauthorizedUserInfo)(user === null || user === void 0 ? void 0 : (_user$profile2 = user.profile) === null || _user$profile2 === void 0 ? void 0 : _user$profile2.name, {}));
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
var now = parseInt(Date.now() / 1000);
|
|
@@ -170,6 +182,13 @@ function dispatchUser(dispatch, userManagerInstance, validateUser) {
|
|
|
170
182
|
|
|
171
183
|
console.debug('User has been successfully loaded from store.');
|
|
172
184
|
return dispatch((0, _actions.setLoggedUser)(user));
|
|
185
|
+
})["catch"](function (e) {
|
|
186
|
+
var _user$profile3;
|
|
187
|
+
|
|
188
|
+
console.log('Error in dispatchUser', e);
|
|
189
|
+
return dispatch((0, _actions.setUserValidationError)(user === null || user === void 0 ? void 0 : (_user$profile3 = user.profile) === null || _user$profile3 === void 0 ? void 0 : _user$profile3.name, {
|
|
190
|
+
error: e
|
|
191
|
+
}));
|
|
173
192
|
});
|
|
174
193
|
} else {
|
|
175
194
|
console.debug('You are not logged in.');
|
|
@@ -199,11 +218,7 @@ function handleSilentRenewCallback(userManagerInstance) {
|
|
|
199
218
|
function handleUser(dispatch, userManager, validateUser) {
|
|
200
219
|
userManager.events.addUserLoaded(function (user) {
|
|
201
220
|
console.debug('user loaded', user);
|
|
202
|
-
dispatchUser(dispatch, userManager, validateUser)
|
|
203
|
-
// For now we log it to avoid uncaught Promise for good practice.
|
|
204
|
-
["catch"](function (e) {
|
|
205
|
-
console.log('Error in dispatchUser in addUserLoaded event', e);
|
|
206
|
-
});
|
|
221
|
+
dispatchUser(dispatch, userManager, validateUser);
|
|
207
222
|
});
|
|
208
223
|
userManager.events.addSilentRenewError(function (error) {
|
|
209
224
|
console.debug(error); // wait for accessTokenExpiringNotificationTime so that the user is expired
|
package/lib/utils/actions.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.USER = exports.UNAUTHORIZED_USER_INFO = exports.SIGNIN_CALLBACK_ERROR = exports.SHOW_AUTH_INFO_LOGIN = void 0;
|
|
4
|
+
exports.USER_VALIDATION_ERROR = exports.USER = exports.UNAUTHORIZED_USER_INFO = exports.SIGNIN_CALLBACK_ERROR = exports.SHOW_AUTH_INFO_LOGIN = exports.LOGOUT_ERROR = void 0;
|
|
5
5
|
exports.setLoggedUser = setLoggedUser;
|
|
6
|
+
exports.setLogoutError = setLogoutError;
|
|
6
7
|
exports.setShowAuthenticationRouterLogin = setShowAuthenticationRouterLogin;
|
|
7
8
|
exports.setSignInCallbackError = setSignInCallbackError;
|
|
8
9
|
exports.setUnauthorizedUserInfo = setUnauthorizedUserInfo;
|
|
10
|
+
exports.setUserValidationError = setUserValidationError;
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
@@ -36,10 +38,39 @@ function setSignInCallbackError(signInCallbackError) {
|
|
|
36
38
|
var UNAUTHORIZED_USER_INFO = 'UNAUTHORIZED_USER_INFO';
|
|
37
39
|
exports.UNAUTHORIZED_USER_INFO = UNAUTHORIZED_USER_INFO;
|
|
38
40
|
|
|
39
|
-
function setUnauthorizedUserInfo(unauthorizedUserInfo) {
|
|
41
|
+
function setUnauthorizedUserInfo(userName, unauthorizedUserInfo) {
|
|
40
42
|
return {
|
|
41
43
|
type: UNAUTHORIZED_USER_INFO,
|
|
42
|
-
|
|
44
|
+
authenticationRouterError: {
|
|
45
|
+
userName: userName,
|
|
46
|
+
unauthorizedUserInfo: unauthorizedUserInfo
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var LOGOUT_ERROR = 'LOGOUT_ERROR';
|
|
52
|
+
exports.LOGOUT_ERROR = LOGOUT_ERROR;
|
|
53
|
+
|
|
54
|
+
function setLogoutError(userName, logoutError) {
|
|
55
|
+
return {
|
|
56
|
+
type: LOGOUT_ERROR,
|
|
57
|
+
authenticationRouterError: {
|
|
58
|
+
userName: userName,
|
|
59
|
+
logoutError: logoutError
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var USER_VALIDATION_ERROR = 'USER_VALIDATION_ERROR';
|
|
65
|
+
exports.USER_VALIDATION_ERROR = USER_VALIDATION_ERROR;
|
|
66
|
+
|
|
67
|
+
function setUserValidationError(userName, userValidationError) {
|
|
68
|
+
return {
|
|
69
|
+
type: USER_VALIDATION_ERROR,
|
|
70
|
+
authenticationRouterError: {
|
|
71
|
+
userName: userName,
|
|
72
|
+
userValidationError: userValidationError
|
|
73
|
+
}
|
|
43
74
|
};
|
|
44
75
|
}
|
|
45
76
|
|