@stokr/components-library 2.3.70 → 2.3.72
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.
|
@@ -88,9 +88,9 @@ const Enable2FAFlow = _ref => {
|
|
|
88
88
|
noPadding: true
|
|
89
89
|
}, showSuccess ? /*#__PURE__*/_react.default.createElement(_Sucess2FA.default, {
|
|
90
90
|
onClick: () => {
|
|
91
|
+
onSuccess && onSuccess();
|
|
91
92
|
setshowSuccess(false);
|
|
92
93
|
setShowFlow(false);
|
|
93
|
-
onSuccess && onSuccess();
|
|
94
94
|
},
|
|
95
95
|
subTitleLeft: "Your log in 2FA authentication is now set",
|
|
96
96
|
textRight: "You will now be asked for your 2FA code next time you log in."
|
|
@@ -55,6 +55,8 @@ const Main2FAFlow = _ref => {
|
|
|
55
55
|
const [successMessage, setsuccessMessage] = (0, _react.useState)();
|
|
56
56
|
const [isLoginRequired, setisLoginRequired] = (0, _react.useState)(false);
|
|
57
57
|
const [totpData, settotpData] = (0, _react.useState)();
|
|
58
|
+
const enable2faCompletedRef = (0, _react.useRef)(false);
|
|
59
|
+
const disable2faCompletedRef = (0, _react.useRef)(false);
|
|
58
60
|
(0, _react.useEffect)(() => {
|
|
59
61
|
if ((userMfaEnrollment === null || userMfaEnrollment === void 0 ? void 0 : userMfaEnrollment.length) > 0) {
|
|
60
62
|
setis2FAEnabled(true);
|
|
@@ -94,18 +96,24 @@ const Main2FAFlow = _ref => {
|
|
|
94
96
|
};
|
|
95
97
|
|
|
96
98
|
// Helper to close a flow and call the custom onFlowClose handler
|
|
97
|
-
const handleFlowClose = flowId
|
|
99
|
+
const handleFlowClose = function (flowId) {
|
|
100
|
+
let completed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
98
101
|
setIsFlowOpen(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
99
102
|
[flowId]: false
|
|
100
103
|
}));
|
|
101
|
-
onFlowClose && onFlowClose(
|
|
104
|
+
onFlowClose && onFlowClose({
|
|
105
|
+
flow: flowId,
|
|
106
|
+
completed
|
|
107
|
+
});
|
|
102
108
|
};
|
|
103
109
|
const onEnable2FASuccess = async () => {
|
|
110
|
+
enable2faCompletedRef.current = true;
|
|
104
111
|
setis2FAEnabled(true);
|
|
105
112
|
checkMfaEnrollment();
|
|
106
113
|
setsuccessMessage('Your log in 2FA authentication is now set');
|
|
107
114
|
};
|
|
108
115
|
const onDisable2FASuccess = async () => {
|
|
116
|
+
disable2faCompletedRef.current = true;
|
|
109
117
|
setis2FAEnabled(false);
|
|
110
118
|
checkMfaEnrollment();
|
|
111
119
|
setsuccessMessage('Your log in 2FA authentication is removed');
|
|
@@ -187,7 +195,7 @@ const Main2FAFlow = _ref => {
|
|
|
187
195
|
showFlow: isFlowopen.enable2fa,
|
|
188
196
|
setShowFlow: value => {
|
|
189
197
|
if (!value) {
|
|
190
|
-
handleFlowClose('enable2fa');
|
|
198
|
+
handleFlowClose('enable2fa', enable2faCompletedRef.current);
|
|
191
199
|
} else {
|
|
192
200
|
setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
|
|
193
201
|
enable2fa: value
|
|
@@ -201,7 +209,7 @@ const Main2FAFlow = _ref => {
|
|
|
201
209
|
showFlow: isFlowopen.disable2fa,
|
|
202
210
|
setShowFlow: value => {
|
|
203
211
|
if (!value) {
|
|
204
|
-
handleFlowClose('disable2fa');
|
|
212
|
+
handleFlowClose('disable2fa', disable2faCompletedRef.current);
|
|
205
213
|
} else {
|
|
206
214
|
setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
|
|
207
215
|
disable2fa: value
|