@frontegg/redux-store 6.69.0 → 6.70.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/audits/AuditLogsState/index.js +1 -1
- package/audits/AuditLogsState/saga.js +1 -18
- package/audits/AuditsMetadataState/index.js +1 -1
- package/audits/AuditsMetadataState/saga.js +1 -5
- package/audits/backward-compatibility/saga.js +0 -18
- package/audits/dummy.js +0 -16
- package/audits/index.js +4 -2
- package/audits/reducer.js +0 -2
- package/auth/AcceptInvitationState/index.d.ts +2 -0
- package/auth/AcceptInvitationState/index.js +1 -1
- package/auth/AcceptInvitationState/interfaces.js +0 -1
- package/auth/AcceptInvitationState/saga.js +0 -3
- package/auth/AccountSettingsState/index.d.ts +2 -0
- package/auth/AccountSettingsState/index.js +1 -1
- package/auth/AccountSettingsState/interfaces.d.ts +2 -0
- package/auth/AccountSettingsState/saga.js +1 -11
- package/auth/ActivateState/index.d.ts +3 -0
- package/auth/ActivateState/index.js +1 -1
- package/auth/ActivateState/interfaces.js +0 -1
- package/auth/ActivateState/saga.js +14 -34
- package/auth/ApiTokensState/index.d.ts +2 -0
- package/auth/ApiTokensState/index.js +1 -1
- package/auth/ApiTokensState/interfaces.d.ts +1 -0
- package/auth/ApiTokensState/interfaces.js +0 -1
- package/auth/ApiTokensState/saga.js +1 -44
- package/auth/ForgotPasswordState/index.d.ts +2 -0
- package/auth/ForgotPasswordState/index.js +1 -1
- package/auth/ForgotPasswordState/interfaces.js +0 -1
- package/auth/ForgotPasswordState/saga.js +5 -12
- package/auth/ImpersonationState/index.d.ts +2 -0
- package/auth/ImpersonationState/index.js +1 -1
- package/auth/ImpersonationState/interfaces.js +0 -1
- package/auth/ImpersonationState/saga.js +5 -9
- package/auth/LoginState/index.d.ts +2 -0
- package/auth/LoginState/index.js +1 -1
- package/auth/LoginState/interfaces.js +0 -6
- package/auth/LoginState/saga.d.ts +2 -38
- package/auth/LoginState/saga.js +132 -292
- package/auth/MfaState/index.d.ts +4 -2
- package/auth/MfaState/index.js +1 -1
- package/auth/MfaState/interfaces.d.ts +2 -2
- package/auth/MfaState/interfaces.js +0 -1
- package/auth/MfaState/saga.js +64 -143
- package/auth/ProfileState/index.d.ts +2 -0
- package/auth/ProfileState/index.js +1 -1
- package/auth/ProfileState/saga.js +22 -50
- package/auth/Provisioning/index.d.ts +2 -0
- package/auth/Provisioning/index.js +1 -1
- package/auth/Provisioning/saga.js +11 -23
- package/auth/ResetPhoneNumberState/index.d.ts +2 -0
- package/auth/ResetPhoneNumberState/index.js +1 -1
- package/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/auth/ResetPhoneNumberState/saga.js +17 -26
- package/auth/RestrictionsState/index.d.ts +3 -0
- package/auth/RestrictionsState/index.js +1 -1
- package/auth/RestrictionsState/saga.js +52 -105
- package/auth/RolesState/index.d.ts +2 -0
- package/auth/RolesState/index.js +1 -1
- package/auth/RolesState/saga.js +30 -51
- package/auth/SSOState/index.d.ts +2 -0
- package/auth/SSOState/index.js +1 -1
- package/auth/SSOState/interfaces.js +0 -3
- package/auth/SSOState/saga.js +10 -58
- package/auth/SSOState/saga.v2.js +13 -49
- package/auth/SecurityPolicyState/index.d.ts +13 -0
- package/auth/SecurityPolicyState/index.js +1 -1
- package/auth/SecurityPolicyState/saga.js +36 -90
- package/auth/SessionsPolicyState/index.d.ts +2 -0
- package/auth/SessionsPolicyState/index.js +1 -1
- package/auth/SessionsPolicyState/saga.js +7 -19
- package/auth/SessionsState/index.d.ts +2 -0
- package/auth/SessionsState/index.js +1 -1
- package/auth/SessionsState/saga.js +1 -15
- package/auth/SignUp/index.d.ts +2 -0
- package/auth/SignUp/index.js +1 -1
- package/auth/SignUp/interfaces.js +0 -1
- package/auth/SignUp/saga.js +6 -15
- package/auth/SocialLogins/index.d.ts +2 -0
- package/auth/SocialLogins/index.js +1 -1
- package/auth/SocialLogins/saga.js +10 -20
- package/auth/TeamState/index.d.ts +2 -0
- package/auth/TeamState/index.js +1 -1
- package/auth/TeamState/interfaces.js +0 -1
- package/auth/TeamState/saga.js +85 -205
- package/auth/TenantsState/index.d.ts +2 -0
- package/auth/TenantsState/index.js +1 -1
- package/auth/TenantsState/saga.js +1 -17
- package/auth/index.d.ts +2 -2
- package/auth/index.js +4 -3
- package/auth/interfaces.d.ts +2 -1
- package/auth/interfaces.js +0 -6
- package/auth/reducer.d.ts +2 -2
- package/auth/reducer.js +0 -2
- package/auth/saga.js +2 -1
- package/auth/utils.d.ts +4 -0
- package/auth/utils.js +7 -21
- package/connectivity/ConnectivityState/index.d.ts +9 -0
- package/connectivity/ConnectivityState/index.js +1 -1
- package/connectivity/consts.js +0 -5
- package/connectivity/index.js +4 -2
- package/connectivity/interfaces.d.ts +1 -0
- package/connectivity/reducer.js +0 -2
- package/connectivity/saga.js +48 -85
- package/helpers.js +4 -7
- package/index.js +1 -1
- package/node/audits/AuditLogsState/index.js +1 -8
- package/node/audits/AuditLogsState/saga.js +1 -26
- package/node/audits/AuditsMetadataState/index.js +1 -8
- package/node/audits/AuditsMetadataState/saga.js +1 -10
- package/node/audits/backward-compatibility/index.js +0 -8
- package/node/audits/backward-compatibility/reducer.js +0 -5
- package/node/audits/backward-compatibility/saga.js +0 -23
- package/node/audits/dummy.js +0 -19
- package/node/audits/index.js +0 -14
- package/node/audits/initialState.js +0 -3
- package/node/audits/reducer.js +0 -8
- package/node/audits/saga.js +0 -5
- package/node/audits/utils.js +0 -4
- package/node/auth/AcceptInvitationState/index.js +1 -7
- package/node/auth/AcceptInvitationState/interfaces.js +0 -1
- package/node/auth/AcceptInvitationState/saga.js +0 -7
- package/node/auth/AccountSettingsState/index.js +1 -6
- package/node/auth/AccountSettingsState/saga.js +1 -16
- package/node/auth/ActivateState/index.js +1 -7
- package/node/auth/ActivateState/interfaces.js +0 -1
- package/node/auth/ActivateState/saga.js +14 -41
- package/node/auth/ApiTokensState/index.js +1 -6
- package/node/auth/ApiTokensState/interfaces.js +0 -1
- package/node/auth/ApiTokensState/saga.js +1 -51
- package/node/auth/ForgotPasswordState/index.js +1 -7
- package/node/auth/ForgotPasswordState/interfaces.js +0 -1
- package/node/auth/ForgotPasswordState/saga.js +5 -19
- package/node/auth/ImpersonationState/index.js +1 -7
- package/node/auth/ImpersonationState/interfaces.js +0 -1
- package/node/auth/ImpersonationState/saga.js +5 -15
- package/node/auth/LoginState/index.js +1 -7
- package/node/auth/LoginState/interfaces.js +0 -7
- package/node/auth/LoginState/saga.js +132 -322
- package/node/auth/MfaState/index.js +1 -7
- package/node/auth/MfaState/interfaces.js +0 -1
- package/node/auth/MfaState/saga.js +64 -137
- package/node/auth/ProfileState/index.js +1 -6
- package/node/auth/ProfileState/saga.js +22 -58
- package/node/auth/Provisioning/index.js +1 -6
- package/node/auth/Provisioning/saga.js +11 -28
- package/node/auth/ResetPhoneNumberState/index.js +1 -7
- package/node/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/node/auth/ResetPhoneNumberState/saga.js +17 -32
- package/node/auth/RestrictionsState/index.js +1 -7
- package/node/auth/RestrictionsState/saga.js +52 -109
- package/node/auth/RolesState/index.js +1 -6
- package/node/auth/RolesState/saga.js +30 -54
- package/node/auth/SSOState/index.js +1 -6
- package/node/auth/SSOState/interfaces.js +0 -3
- package/node/auth/SSOState/saga.js +10 -63
- package/node/auth/SSOState/saga.v2.js +13 -53
- package/node/auth/SecurityPolicyState/index.js +1 -6
- package/node/auth/SecurityPolicyState/saga.js +36 -89
- package/node/auth/SessionsPolicyState/index.js +1 -6
- package/node/auth/SessionsPolicyState/saga.js +7 -24
- package/node/auth/SessionsState/index.js +1 -6
- package/node/auth/SessionsState/saga.js +1 -22
- package/node/auth/SignUp/index.js +1 -7
- package/node/auth/SignUp/interfaces.js +0 -1
- package/node/auth/SignUp/saga.js +6 -30
- package/node/auth/SocialLogins/index.js +1 -6
- package/node/auth/SocialLogins/saga.js +10 -33
- package/node/auth/TeamState/index.js +1 -6
- package/node/auth/TeamState/interfaces.js +0 -1
- package/node/auth/TeamState/saga.js +86 -190
- package/node/auth/TenantsState/index.js +1 -6
- package/node/auth/TenantsState/saga.js +1 -24
- package/node/auth/dummy.js +0 -5
- package/node/auth/index.js +0 -90
- package/node/auth/initialState.js +0 -23
- package/node/auth/interfaces.js +0 -6
- package/node/auth/reducer.js +0 -28
- package/node/auth/saga.js +2 -26
- package/node/auth/utils.js +7 -42
- package/node/connectivity/ConnectivityState/index.js +1 -7
- package/node/connectivity/consts.js +1 -7
- package/node/connectivity/index.js +0 -5
- package/node/connectivity/reducer.js +0 -6
- package/node/connectivity/saga.js +47 -91
- package/node/helpers.js +2 -14
- package/node/index.js +1 -17
- package/node/subscriptions/Billing/Information/index.js +0 -7
- package/node/subscriptions/Billing/Information/saga.js +1 -25
- package/node/subscriptions/Billing/Invoices/index.js +0 -6
- package/node/subscriptions/Billing/Invoices/saga.js +1 -13
- package/node/subscriptions/Billing/PaymentMethod/index.js +2 -8
- package/node/subscriptions/Billing/PaymentMethod/interfaces.js +0 -1
- package/node/subscriptions/Billing/PaymentMethod/saga.js +1 -17
- package/node/subscriptions/Billing/Subscription/index.js +0 -6
- package/node/subscriptions/Billing/Subscription/saga.js +3 -23
- package/node/subscriptions/Billing/index.js +0 -6
- package/node/subscriptions/Billing/interfaces.js +0 -8
- package/node/subscriptions/Billing/saga.js +0 -7
- package/node/subscriptions/Checkout/index.js +0 -6
- package/node/subscriptions/Checkout/saga.js +2 -22
- package/node/subscriptions/Config/index.js +0 -6
- package/node/subscriptions/Config/saga.js +1 -12
- package/node/subscriptions/Plans/index.js +0 -6
- package/node/subscriptions/Plans/saga.js +1 -13
- package/node/subscriptions/Stripe/index.js +0 -6
- package/node/subscriptions/Stripe/saga.js +0 -8
- package/node/subscriptions/VendorPublicConfig/index.js +0 -6
- package/node/subscriptions/VendorPublicConfig/saga.js +1 -9
- package/node/subscriptions/dummy.js +2 -4
- package/node/subscriptions/general.interfaces.js +0 -5
- package/node/subscriptions/index.js +0 -5
- package/node/subscriptions/interfaces.js +0 -14
- package/node/subscriptions/mapper.js +0 -11
- package/node/subscriptions/reducer.js +0 -9
- package/node/subscriptions/saga.js +0 -9
- package/node/subscriptions/utils.js +0 -6
- package/node/toolkit/index.js +0 -31
- package/node/toolkit/redux-saga.js +0 -3
- package/node/toolkit/redux.js +0 -1
- package/node/vendor/VendorState/index.js +1 -7
- package/node/vendor/index.js +0 -5
- package/node/vendor/reducer.js +0 -6
- package/node/vendor/saga.js +1 -9
- package/package.json +1 -1
- package/subscriptions/Billing/Information/index.js +0 -4
- package/subscriptions/Billing/Information/saga.js +1 -12
- package/subscriptions/Billing/Invoices/index.js +0 -4
- package/subscriptions/Billing/Invoices/saga.js +1 -5
- package/subscriptions/Billing/PaymentMethod/index.js +2 -6
- package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -1
- package/subscriptions/Billing/PaymentMethod/saga.js +1 -9
- package/subscriptions/Billing/Subscription/index.js +0 -4
- package/subscriptions/Billing/Subscription/saga.js +3 -17
- package/subscriptions/Billing/interfaces.js +1 -0
- package/subscriptions/Checkout/index.js +0 -4
- package/subscriptions/Checkout/saga.js +2 -12
- package/subscriptions/Config/index.js +0 -4
- package/subscriptions/Config/saga.js +1 -7
- package/subscriptions/Plans/index.js +0 -2
- package/subscriptions/Plans/saga.js +1 -6
- package/subscriptions/Stripe/index.js +0 -4
- package/subscriptions/Stripe/saga.js +0 -4
- package/subscriptions/VendorPublicConfig/index.js +0 -2
- package/subscriptions/VendorPublicConfig/saga.js +1 -4
- package/subscriptions/dummy.js +3 -2
- package/subscriptions/general.interfaces.js +0 -5
- package/subscriptions/index.js +3 -1
- package/subscriptions/mapper.js +0 -5
- package/toolkit/index.d.ts +1 -1
- package/toolkit/index.js +0 -9
- package/vendor/VendorState/index.js +1 -0
- package/vendor/index.js +4 -2
- package/vendor/reducer.js +0 -2
- package/vendor/saga.js +1 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -13,69 +12,49 @@ exports.loginSagas = loginSagas;
|
|
|
13
12
|
exports.loginSagasMock = loginSagasMock;
|
|
14
13
|
exports.refreshMetadata = refreshMetadata;
|
|
15
14
|
exports.refreshToken = refreshToken;
|
|
16
|
-
|
|
17
15
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
18
|
-
|
|
19
16
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
20
|
-
|
|
21
17
|
var _effects = require("redux-saga/effects");
|
|
22
|
-
|
|
23
18
|
var _restApi = require("@frontegg/rest-api");
|
|
24
|
-
|
|
25
19
|
var _reducer = require("../reducer");
|
|
26
|
-
|
|
27
20
|
var _constants = require("../../constants");
|
|
28
|
-
|
|
29
21
|
var _interfaces = require("../interfaces");
|
|
30
|
-
|
|
31
22
|
var _interfaces2 = require("./interfaces");
|
|
32
|
-
|
|
33
23
|
var _saga = require("../SignUp/saga");
|
|
34
|
-
|
|
35
24
|
var _interfaces3 = require("../MfaState/interfaces");
|
|
36
|
-
|
|
37
25
|
var _dummy = require("../dummy");
|
|
38
|
-
|
|
39
26
|
var _interfaces4 = require("../SSOState/interfaces");
|
|
40
|
-
|
|
41
27
|
var _saga2 = require("../../vendor/saga");
|
|
42
|
-
|
|
43
28
|
var _helpers = require("../../helpers");
|
|
44
|
-
|
|
45
29
|
var _interfaces5 = require("../ResetPhoneNumberState/interfaces");
|
|
46
|
-
|
|
47
30
|
var _utils = require("../utils");
|
|
48
|
-
|
|
49
31
|
var _saga3 = require("../SecurityPolicyState/saga");
|
|
50
|
-
|
|
51
32
|
const _excluded = ["callback"],
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
33
|
+
_excluded2 = ["callback"],
|
|
34
|
+
_excluded3 = ["callback"],
|
|
35
|
+
_excluded4 = ["callback"],
|
|
36
|
+
_excluded5 = ["callback", "events"],
|
|
37
|
+
_excluded6 = ["callback"],
|
|
38
|
+
_excluded7 = ["callback"],
|
|
39
|
+
_excluded8 = ["callback"],
|
|
40
|
+
_excluded9 = ["callback"],
|
|
41
|
+
_excluded10 = ["callback"],
|
|
42
|
+
_excluded11 = ["callback"],
|
|
43
|
+
_excluded12 = ["callback"],
|
|
44
|
+
_excluded13 = ["callback"],
|
|
45
|
+
_excluded14 = ["callback"],
|
|
46
|
+
_excluded15 = ["callback", "deviceId"],
|
|
47
|
+
_excluded16 = ["callback", "deviceId"],
|
|
48
|
+
_excluded17 = ["callback", "deviceId"],
|
|
49
|
+
_excluded18 = ["callback", "deviceId"];
|
|
69
50
|
const authStrategyLoginStepMap = {
|
|
70
51
|
[_restApi.AuthStrategyEnum.Code]: _interfaces2.LoginStep.loginWithOtc,
|
|
71
52
|
[_restApi.AuthStrategyEnum.EmailAndPassword]: _interfaces2.LoginStep.loginWithPassword,
|
|
72
53
|
[_restApi.AuthStrategyEnum.MagicLink]: _interfaces2.LoginStep.magicLinkPreLoginSuccess,
|
|
73
54
|
[_restApi.AuthStrategyEnum.SmsCode]: _interfaces2.LoginStep.loginWithSmsOtc
|
|
74
55
|
};
|
|
75
|
-
|
|
76
56
|
function* afterAuthNavigation() {
|
|
77
57
|
var _window;
|
|
78
|
-
|
|
79
58
|
const onRedirectTo = _restApi.ContextHolder.onRedirectTo;
|
|
80
59
|
const {
|
|
81
60
|
routes,
|
|
@@ -91,47 +70,37 @@ function* afterAuthNavigation() {
|
|
|
91
70
|
authenticatedUrl
|
|
92
71
|
} = routes;
|
|
93
72
|
const afterAuthRedirect = window.localStorage.getItem(_constants.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
|
|
94
|
-
|
|
95
73
|
if (afterAuthRedirect && ![loginUrl, logoutUrl, socialLoginCallbackUrl, activateUrl].includes(afterAuthRedirect)) {
|
|
96
74
|
authenticatedUrl = afterAuthRedirect;
|
|
97
75
|
}
|
|
98
|
-
|
|
99
76
|
window.localStorage.removeItem(_constants.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
|
|
100
77
|
yield (0, _effects.delay)(200);
|
|
101
78
|
(0, _effects.put)(_reducer.actions.resetLoginState());
|
|
102
79
|
const url = new URL((_window = window) == null ? void 0 : _window.location.href);
|
|
103
80
|
let redirectUrl = authenticatedUrl;
|
|
104
|
-
|
|
105
81
|
if (url.searchParams.get('redirectUrl')) {
|
|
106
82
|
var _url$searchParams$get;
|
|
107
|
-
|
|
108
83
|
redirectUrl = (_url$searchParams$get = url.searchParams.get('redirectUrl')) != null ? _url$searchParams$get : authenticatedUrl;
|
|
109
84
|
} else if (includeQueryParam) {
|
|
110
85
|
redirectUrl += window.location.search;
|
|
111
86
|
}
|
|
112
|
-
|
|
113
87
|
onRedirectTo(redirectUrl, {
|
|
114
88
|
refresh: redirectUrl.startsWith('http')
|
|
115
89
|
});
|
|
116
90
|
}
|
|
117
|
-
|
|
118
91
|
function* refreshMetadata() {
|
|
119
92
|
let ssoACS;
|
|
120
|
-
|
|
121
93
|
try {
|
|
122
94
|
var _metadata$configurati;
|
|
123
|
-
|
|
124
95
|
const metadata = yield (0, _effects.call)(_restApi.api.metadata.getSamlMetadata);
|
|
125
96
|
ssoACS = metadata == null ? void 0 : (_metadata$configurati = metadata.configuration) == null ? void 0 : _metadata$configurati.acsUrl;
|
|
126
97
|
} catch (e) {
|
|
127
98
|
console.error(e);
|
|
128
99
|
}
|
|
129
|
-
|
|
130
100
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
131
101
|
ssoACS
|
|
132
102
|
}));
|
|
133
103
|
}
|
|
134
|
-
|
|
135
104
|
function* loadSSOPublicConfigurationFunction() {
|
|
136
105
|
try {
|
|
137
106
|
const {
|
|
@@ -144,25 +113,18 @@ function* loadSSOPublicConfigurationFunction() {
|
|
|
144
113
|
console.error(e);
|
|
145
114
|
}
|
|
146
115
|
}
|
|
147
|
-
|
|
148
116
|
const isMfaRequired = user => {
|
|
149
117
|
if (user.mfaRequired && user.mfaToken) {
|
|
150
118
|
_restApi.ContextHolder.setAccessToken(null);
|
|
151
|
-
|
|
152
119
|
_restApi.ContextHolder.setUser(null);
|
|
153
|
-
|
|
154
120
|
return true;
|
|
155
121
|
} else {
|
|
156
122
|
_restApi.ContextHolder.setAccessToken(user.accessToken);
|
|
157
|
-
|
|
158
123
|
_restApi.ContextHolder.setUser(user);
|
|
159
|
-
|
|
160
124
|
return false;
|
|
161
125
|
}
|
|
162
126
|
};
|
|
163
|
-
|
|
164
127
|
exports.isMfaRequired = isMfaRequired;
|
|
165
|
-
|
|
166
128
|
const getNumberOfMfaDevices = mfaDevices => {
|
|
167
129
|
const numberOfWebAuthnDevices = +Boolean(mfaDevices.webauthn.length);
|
|
168
130
|
const numberOfPhoneDevices = +Boolean(mfaDevices.phones.length);
|
|
@@ -175,14 +137,12 @@ const getNumberOfMfaDevices = mfaDevices => {
|
|
|
175
137
|
totalDevices
|
|
176
138
|
};
|
|
177
139
|
};
|
|
178
|
-
|
|
179
140
|
const getMfaStepForEnrolledUsers = mfaDevices => {
|
|
180
141
|
const {
|
|
181
142
|
numberOfPhoneDevices,
|
|
182
143
|
numberOfAuthenticators,
|
|
183
144
|
totalDevices
|
|
184
145
|
} = getNumberOfMfaDevices(mfaDevices);
|
|
185
|
-
|
|
186
146
|
if (totalDevices === 1) {
|
|
187
147
|
if (numberOfAuthenticators) {
|
|
188
148
|
return _interfaces3.MFAStep.authenticatorApp;
|
|
@@ -190,24 +150,19 @@ const getMfaStepForEnrolledUsers = mfaDevices => {
|
|
|
190
150
|
return _interfaces3.MFAStep.smsVerifyCode;
|
|
191
151
|
}
|
|
192
152
|
}
|
|
193
|
-
|
|
194
153
|
return _interfaces3.MFAStep.verify;
|
|
195
154
|
};
|
|
196
|
-
|
|
197
155
|
const getMfaStepForNotEnrolledUsers = mfaStrategies => {
|
|
198
156
|
if (mfaStrategies.length === 1) {
|
|
199
157
|
const [strategy] = mfaStrategies;
|
|
200
|
-
|
|
201
158
|
if (strategy === _restApi.MFAStrategyEnum.AuthenticatorApp) {
|
|
202
159
|
return _interfaces3.MFAStep.authenticatorApp;
|
|
203
160
|
} else if (strategy === _restApi.MFAStrategyEnum.SMS) {
|
|
204
161
|
return _interfaces3.MFAStep.smsSetPhoneNumber;
|
|
205
162
|
}
|
|
206
163
|
}
|
|
207
|
-
|
|
208
164
|
return _interfaces3.MFAStep.verify;
|
|
209
165
|
};
|
|
210
|
-
|
|
211
166
|
function* getMfaRequiredState(user) {
|
|
212
167
|
let step = _interfaces2.LoginStep.loginWithTwoFactor;
|
|
213
168
|
let mfaState = {};
|
|
@@ -219,7 +174,6 @@ function* getMfaRequiredState(user) {
|
|
|
219
174
|
mfaDeviceExpiration
|
|
220
175
|
} = yield (0, _effects.call)(_restApi.api.auth.checkIfAllowToRememberMfaDevice, user.mfaToken);
|
|
221
176
|
const isEnrolled = !(user.hasOwnProperty('mfaEnrolled') && !user.mfaEnrolled);
|
|
222
|
-
|
|
223
177
|
if (isEnrolled) {
|
|
224
178
|
mfaState = {
|
|
225
179
|
mfaDevices: user.mfaDevices,
|
|
@@ -236,17 +190,14 @@ function* getMfaRequiredState(user) {
|
|
|
236
190
|
};
|
|
237
191
|
step = _interfaces2.LoginStep.forceTwoFactor;
|
|
238
192
|
}
|
|
239
|
-
|
|
240
193
|
let quickLoginState = {};
|
|
241
194
|
const quickLoginToRegister = localStorage.getItem('register-quick-login');
|
|
242
|
-
|
|
243
195
|
if (quickLoginToRegister) {
|
|
244
196
|
quickLoginState = {
|
|
245
197
|
quickLoginToRegister,
|
|
246
198
|
flow: _interfaces2.LoginFlow.RegisterQuickLogin
|
|
247
199
|
};
|
|
248
200
|
}
|
|
249
|
-
|
|
250
201
|
return {
|
|
251
202
|
user: undefined,
|
|
252
203
|
isAuthenticated: false,
|
|
@@ -265,36 +216,29 @@ function* getMfaRequiredState(user) {
|
|
|
265
216
|
})
|
|
266
217
|
};
|
|
267
218
|
}
|
|
268
|
-
|
|
269
219
|
function* refreshToken() {
|
|
270
220
|
const {
|
|
271
221
|
hostedLoginBox
|
|
272
222
|
} = yield (0, _effects.select)(state => state.auth);
|
|
273
|
-
|
|
274
223
|
if (hostedLoginBox) {
|
|
275
224
|
yield (0, _effects.call)(refreshTokenHosted);
|
|
276
225
|
} else {
|
|
277
226
|
yield (0, _effects.call)(refreshTokenEmbedded);
|
|
278
227
|
}
|
|
279
228
|
}
|
|
280
|
-
|
|
281
229
|
function* refreshTokenHosted() {
|
|
282
230
|
const {
|
|
283
231
|
user
|
|
284
232
|
} = yield (0, _effects.select)(state => state.auth);
|
|
285
|
-
|
|
286
233
|
if (!(user != null && user.refreshToken)) {
|
|
287
234
|
_restApi.ContextHolder.setAccessToken(null);
|
|
288
|
-
|
|
289
235
|
_restApi.ContextHolder.setUser(null);
|
|
290
|
-
|
|
291
236
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
292
237
|
user: null,
|
|
293
238
|
isAuthenticated: false
|
|
294
239
|
}));
|
|
295
240
|
return;
|
|
296
241
|
}
|
|
297
|
-
|
|
298
242
|
try {
|
|
299
243
|
const body = {
|
|
300
244
|
grant_type: 'refresh_token',
|
|
@@ -308,16 +252,13 @@ function* refreshTokenHosted() {
|
|
|
308
252
|
yield (0, _effects.put)(_reducer.actions.loadTenants());
|
|
309
253
|
} catch (e) {
|
|
310
254
|
_restApi.ContextHolder.setAccessToken(null);
|
|
311
|
-
|
|
312
255
|
_restApi.ContextHolder.setUser(null);
|
|
313
|
-
|
|
314
256
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
315
257
|
user: null,
|
|
316
258
|
isAuthenticated: false
|
|
317
259
|
}));
|
|
318
260
|
}
|
|
319
261
|
}
|
|
320
|
-
|
|
321
262
|
function* refreshTokenEmbedded() {
|
|
322
263
|
try {
|
|
323
264
|
const onRedirectTo = _restApi.ContextHolder.onRedirectTo;
|
|
@@ -329,7 +270,6 @@ function* refreshTokenEmbedded() {
|
|
|
329
270
|
user,
|
|
330
271
|
tenants
|
|
331
272
|
} = yield (0, _effects.call)(_restApi.api.auth.refreshTokenV2);
|
|
332
|
-
|
|
333
273
|
if (isMfaRequired(user)) {
|
|
334
274
|
const mfaRequiredState = yield getMfaRequiredState(user);
|
|
335
275
|
yield (0, _effects.put)(_reducer.actions.setState(mfaRequiredState));
|
|
@@ -338,11 +278,9 @@ function* refreshTokenEmbedded() {
|
|
|
338
278
|
});
|
|
339
279
|
} else {
|
|
340
280
|
var _ref, _window2;
|
|
341
|
-
|
|
342
281
|
if (user.id) {
|
|
343
282
|
localStorage.setItem('userId', user.id);
|
|
344
283
|
}
|
|
345
|
-
|
|
346
284
|
const quickLoginToRegister = (_ref = localStorage.getItem('register-quick-login')) != null ? _ref : loginState.quickLoginToRegister;
|
|
347
285
|
const shouldNavigateToRegisterQuickLogin = quickLoginToRegister && localStorage.getItem(`${user.id}-${quickLoginToRegister}`) !== 'true' && !window.location.pathname.endsWith(routes.logoutUrl);
|
|
348
286
|
yield (0, _effects.put)(_reducer.actions.setTenantsState({
|
|
@@ -360,11 +298,9 @@ function* refreshTokenEmbedded() {
|
|
|
360
298
|
const url = new URL((_window2 = window) == null ? void 0 : _window2.location.href);
|
|
361
299
|
const invitationToken = url.searchParams.get('invitationToken');
|
|
362
300
|
const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl];
|
|
363
|
-
|
|
364
301
|
if (!invitationToken) {
|
|
365
302
|
redirectRoutes.push(routes.loginUrl, routes.signUpUrl);
|
|
366
303
|
}
|
|
367
|
-
|
|
368
304
|
if (shouldNavigateToRegisterQuickLogin) {
|
|
369
305
|
onRedirectTo(routes.loginUrl);
|
|
370
306
|
} else if (redirectRoutes.some(url => url && window.location.pathname.endsWith(url))) {
|
|
@@ -379,16 +315,13 @@ function* refreshTokenEmbedded() {
|
|
|
379
315
|
}
|
|
380
316
|
} catch (e) {
|
|
381
317
|
_restApi.ContextHolder.setAccessToken(null);
|
|
382
|
-
|
|
383
318
|
_restApi.ContextHolder.setUser(null);
|
|
384
|
-
|
|
385
319
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
386
320
|
user: undefined,
|
|
387
321
|
isAuthenticated: false
|
|
388
322
|
}));
|
|
389
323
|
}
|
|
390
324
|
}
|
|
391
|
-
|
|
392
325
|
function* getUserIP({
|
|
393
326
|
payload: {
|
|
394
327
|
callback
|
|
@@ -406,12 +339,10 @@ function* getUserIP({
|
|
|
406
339
|
callback == null ? void 0 : callback(false);
|
|
407
340
|
}
|
|
408
341
|
}
|
|
409
|
-
|
|
410
342
|
function* requestAuthorize({
|
|
411
343
|
payload: firstTime
|
|
412
344
|
}) {
|
|
413
345
|
const calls = [];
|
|
414
|
-
|
|
415
346
|
if (firstTime) {
|
|
416
347
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
417
348
|
isLoading: true
|
|
@@ -423,14 +354,12 @@ function* requestAuthorize({
|
|
|
423
354
|
calls.push((0, _effects.call)(_saga2.loadVendorPublicInfo));
|
|
424
355
|
calls.push((0, _effects.call)(refreshMetadata));
|
|
425
356
|
}
|
|
426
|
-
|
|
427
357
|
calls.push((0, _effects.call)(refreshToken));
|
|
428
358
|
yield (0, _effects.all)(calls);
|
|
429
359
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
430
360
|
isLoading: false
|
|
431
361
|
}));
|
|
432
362
|
}
|
|
433
|
-
|
|
434
363
|
function* isMFARequiredSSR({
|
|
435
364
|
accessToken,
|
|
436
365
|
user
|
|
@@ -442,12 +371,10 @@ function* isMFARequiredSSR({
|
|
|
442
371
|
}));
|
|
443
372
|
return;
|
|
444
373
|
}
|
|
445
|
-
|
|
446
374
|
const onRedirectTo = _restApi.ContextHolder.onRedirectTo;
|
|
447
375
|
const {
|
|
448
376
|
routes
|
|
449
377
|
} = yield (0, _effects.select)(state => state.auth);
|
|
450
|
-
|
|
451
378
|
if (isMfaRequired(user)) {
|
|
452
379
|
const mfaRequiredState = yield getMfaRequiredState(user);
|
|
453
380
|
yield (0, _effects.put)(_reducer.actions.setState(mfaRequiredState));
|
|
@@ -456,7 +383,6 @@ function* isMFARequiredSSR({
|
|
|
456
383
|
});
|
|
457
384
|
}
|
|
458
385
|
}
|
|
459
|
-
|
|
460
386
|
function* requestAuthorizeSSR({
|
|
461
387
|
payload
|
|
462
388
|
}) {
|
|
@@ -469,17 +395,13 @@ function* requestAuthorizeSSR({
|
|
|
469
395
|
calls.push((0, _effects.call)(isMFARequiredSSR, payload));
|
|
470
396
|
yield (0, _effects.all)(calls);
|
|
471
397
|
}
|
|
472
|
-
|
|
473
398
|
const getUri = urlStrategy => {
|
|
474
399
|
if (urlStrategy === 'path') {
|
|
475
400
|
var _window3;
|
|
476
|
-
|
|
477
401
|
return ((_window3 = window) != null ? _window3 : document).location.pathname;
|
|
478
402
|
} else {
|
|
479
403
|
var _window4;
|
|
480
|
-
|
|
481
|
-
let uri = (((_window4 = window) != null ? _window4 : document).location.hash || '#').substring(1);
|
|
482
|
-
|
|
404
|
+
const uri = (((_window4 = window) != null ? _window4 : document).location.hash || '#').substring(1);
|
|
483
405
|
if (uri.indexOf('?') !== -1) {
|
|
484
406
|
return uri.substring(0, uri.indexOf('?'));
|
|
485
407
|
} else {
|
|
@@ -487,10 +409,8 @@ const getUri = urlStrategy => {
|
|
|
487
409
|
}
|
|
488
410
|
}
|
|
489
411
|
};
|
|
490
|
-
|
|
491
412
|
function* requestHostedLoginSilentAuthorize() {
|
|
492
413
|
const user = yield (0, _effects.call)(_restApi.api.auth.silentOAuthRefreshToken);
|
|
493
|
-
|
|
494
414
|
if (user) {
|
|
495
415
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
496
416
|
user,
|
|
@@ -504,7 +424,6 @@ function* requestHostedLoginSilentAuthorize() {
|
|
|
504
424
|
throw new Error(`couldn't refresh user token with oauth service`);
|
|
505
425
|
}
|
|
506
426
|
}
|
|
507
|
-
|
|
508
427
|
function* refreshOrRequestHostedLoginAuthorize({
|
|
509
428
|
payload: additionalParams
|
|
510
429
|
}) {
|
|
@@ -513,18 +432,15 @@ function* refreshOrRequestHostedLoginAuthorize({
|
|
|
513
432
|
} = yield (0, _effects.select)(state => ({
|
|
514
433
|
disableSilentRefresh: state.auth.disableSilentRefresh
|
|
515
434
|
}));
|
|
516
|
-
|
|
517
435
|
try {
|
|
518
436
|
if (disableSilentRefresh) {
|
|
519
437
|
throw new Error('silent refresh is disabled');
|
|
520
438
|
}
|
|
521
|
-
|
|
522
439
|
yield requestHostedLoginSilentAuthorize();
|
|
523
440
|
} catch (e) {
|
|
524
441
|
yield requestHostedLoginAuthorize(additionalParams);
|
|
525
442
|
}
|
|
526
443
|
}
|
|
527
|
-
|
|
528
444
|
function* requestHostedLoginAuthorize(additionalParams) {
|
|
529
445
|
const {
|
|
530
446
|
routes,
|
|
@@ -538,26 +454,23 @@ function* requestHostedLoginAuthorize(additionalParams) {
|
|
|
538
454
|
urlStrategy: state.root.urlStrategy
|
|
539
455
|
}));
|
|
540
456
|
const activeUri = getUri(urlStrategy);
|
|
541
|
-
|
|
542
457
|
if (activeUri === routes.hostedLoginRedirectUrl) {
|
|
543
458
|
console.debug('Calling loginWithRedirect while in hostedLoginCallback route');
|
|
544
459
|
return;
|
|
545
460
|
}
|
|
546
|
-
|
|
547
461
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
548
462
|
isLoading: true
|
|
549
|
-
}));
|
|
550
|
-
|
|
463
|
+
}));
|
|
464
|
+
// Generate the relevant params for the redirect
|
|
551
465
|
const nonce = (0, _helpers.createRandomString)();
|
|
552
466
|
const code_verifier = (0, _helpers.createRandomString)();
|
|
553
|
-
const code_challenge = yield (0, _effects.call)(_helpers.generateCodeChallenge, code_verifier);
|
|
467
|
+
const code_challenge = yield (0, _effects.call)(_helpers.generateCodeChallenge, code_verifier);
|
|
554
468
|
|
|
469
|
+
// We are saving the verifier in session storage to be able to validate the response
|
|
555
470
|
localStorage.setItem(_constants.HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
|
|
556
471
|
const redirectUrl = `${window.location.origin}${urlStrategy === 'path' ? '' : '#'}${routes.hostedLoginRedirectUrl}`;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
472
|
+
const baseUrl = _restApi.fetch.getBaseUrl(context, '/oauth/authorize');
|
|
473
|
+
// Hard coded for now
|
|
561
474
|
const oauthUrl = `${baseUrl}/oauth/authorize`;
|
|
562
475
|
const params = (0, _extends2.default)({
|
|
563
476
|
response_type: 'code',
|
|
@@ -574,7 +487,6 @@ function* requestHostedLoginAuthorize(additionalParams) {
|
|
|
574
487
|
refresh: true
|
|
575
488
|
});
|
|
576
489
|
}
|
|
577
|
-
|
|
578
490
|
function* handleHostedLoginCallback({
|
|
579
491
|
payload
|
|
580
492
|
}) {
|
|
@@ -594,9 +506,9 @@ function* handleHostedLoginCallback({
|
|
|
594
506
|
code_verifier,
|
|
595
507
|
grant_type: 'authorization_code'
|
|
596
508
|
};
|
|
597
|
-
|
|
598
509
|
try {
|
|
599
|
-
const user = yield (0, _effects.call)(_restApi.api.auth.exchangeOAuthTokens, body);
|
|
510
|
+
const user = yield (0, _effects.call)(_restApi.api.auth.exchangeOAuthTokens, body);
|
|
511
|
+
// TODO: Validate nonce and aud
|
|
600
512
|
|
|
601
513
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
602
514
|
user,
|
|
@@ -609,15 +521,13 @@ function* handleHostedLoginCallback({
|
|
|
609
521
|
yield afterAuthNavigation();
|
|
610
522
|
}
|
|
611
523
|
}
|
|
612
|
-
|
|
613
524
|
function* changePhoneNumberWithVerification(_ref2) {
|
|
614
525
|
let {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
526
|
+
payload: {
|
|
527
|
+
callback
|
|
528
|
+
}
|
|
529
|
+
} = _ref2,
|
|
530
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded);
|
|
621
531
|
try {
|
|
622
532
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
623
533
|
loading: true
|
|
@@ -638,15 +548,13 @@ function* changePhoneNumberWithVerification(_ref2) {
|
|
|
638
548
|
}));
|
|
639
549
|
}
|
|
640
550
|
}
|
|
641
|
-
|
|
642
551
|
function* verifyChangePhoneNumber(_ref3) {
|
|
643
552
|
let {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
553
|
+
payload: {
|
|
554
|
+
callback
|
|
555
|
+
}
|
|
556
|
+
} = _ref3,
|
|
557
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref3.payload, _excluded2);
|
|
650
558
|
try {
|
|
651
559
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
652
560
|
loading: true
|
|
@@ -663,21 +571,20 @@ function* verifyChangePhoneNumber(_ref3) {
|
|
|
663
571
|
}));
|
|
664
572
|
}
|
|
665
573
|
}
|
|
666
|
-
|
|
667
574
|
function* quickSmsPasswordlessPreLogin(_ref4) {
|
|
668
575
|
let {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
576
|
+
payload: {
|
|
577
|
+
callback
|
|
578
|
+
}
|
|
579
|
+
} = _ref4,
|
|
580
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref4.payload, _excluded3);
|
|
675
581
|
try {
|
|
676
582
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
677
583
|
loading: true
|
|
678
|
-
}));
|
|
679
|
-
// @ts-ignore
|
|
584
|
+
}));
|
|
680
585
|
|
|
586
|
+
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
587
|
+
// @ts-ignore
|
|
681
588
|
const preloginRes = yield (0, _effects.call)(_restApi.api.auth.passwordlessPreLogin, (0, _extends2.default)({}, payload, {
|
|
682
589
|
type: _restApi.AuthStrategyEnum.SmsCode
|
|
683
590
|
}));
|
|
@@ -696,15 +603,13 @@ function* quickSmsPasswordlessPreLogin(_ref4) {
|
|
|
696
603
|
callback == null ? void 0 : callback(e);
|
|
697
604
|
}
|
|
698
605
|
}
|
|
699
|
-
|
|
700
606
|
function* passwordlessPreLogin(_ref5) {
|
|
701
607
|
let {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
608
|
+
payload: {
|
|
609
|
+
callback
|
|
610
|
+
}
|
|
611
|
+
} = _ref5,
|
|
612
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref5.payload, _excluded4);
|
|
708
613
|
try {
|
|
709
614
|
const {
|
|
710
615
|
onRedirectTo,
|
|
@@ -720,12 +625,12 @@ function* passwordlessPreLogin(_ref5) {
|
|
|
720
625
|
}));
|
|
721
626
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
722
627
|
loading: true
|
|
723
|
-
}));
|
|
724
|
-
// @ts-ignore
|
|
628
|
+
}));
|
|
725
629
|
|
|
630
|
+
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
631
|
+
// @ts-ignore
|
|
726
632
|
const preloginRes = yield (0, _effects.call)(_restApi.api.auth.passwordlessPreLogin, payload);
|
|
727
633
|
const step = authStrategyLoginStepMap[payload.type];
|
|
728
|
-
|
|
729
634
|
if (step === _interfaces2.LoginStep.loginWithSmsOtc && preloginRes.resetPhoneNumberToken) {
|
|
730
635
|
yield (0, _effects.put)(_reducer.actions.setResetPhoneNumberState({
|
|
731
636
|
resetPhoneNumberToken: preloginRes.resetPhoneNumberToken,
|
|
@@ -734,7 +639,6 @@ function* passwordlessPreLogin(_ref5) {
|
|
|
734
639
|
onRedirectTo(routes.resetPhoneNumberUrl);
|
|
735
640
|
return;
|
|
736
641
|
}
|
|
737
|
-
|
|
738
642
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
739
643
|
step,
|
|
740
644
|
loading: false,
|
|
@@ -751,16 +655,14 @@ function* passwordlessPreLogin(_ref5) {
|
|
|
751
655
|
callback == null ? void 0 : callback();
|
|
752
656
|
}
|
|
753
657
|
}
|
|
754
|
-
|
|
755
658
|
function* passwordlessPostLogin(_ref6) {
|
|
756
659
|
let {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
660
|
+
payload: {
|
|
661
|
+
callback,
|
|
662
|
+
events
|
|
663
|
+
}
|
|
664
|
+
} = _ref6,
|
|
665
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref6.payload, _excluded5);
|
|
764
666
|
try {
|
|
765
667
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
766
668
|
loading: true
|
|
@@ -770,7 +672,6 @@ function* passwordlessPostLogin(_ref6) {
|
|
|
770
672
|
const {
|
|
771
673
|
routes
|
|
772
674
|
} = yield (0, _effects.select)(state => state.auth);
|
|
773
|
-
|
|
774
675
|
if (isMfaRequired(data)) {
|
|
775
676
|
const mfaRequiredState = yield getMfaRequiredState(data);
|
|
776
677
|
yield (0, _effects.put)(_reducer.actions.setState(mfaRequiredState));
|
|
@@ -782,10 +683,8 @@ function* passwordlessPostLogin(_ref6) {
|
|
|
782
683
|
loginState
|
|
783
684
|
} = yield (0, _effects.select)(state => state.auth);
|
|
784
685
|
const user = yield (0, _effects.call)(_restApi.api.auth.generateLoginResponse, data);
|
|
785
|
-
|
|
786
686
|
if (data.emailVerified) {
|
|
787
687
|
var _events$userVerified;
|
|
788
|
-
|
|
789
688
|
events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, {
|
|
790
689
|
email: user.email,
|
|
791
690
|
origin: _interfaces.UserVeirifedOriginTypes.PASSWORDLESS,
|
|
@@ -795,11 +694,9 @@ function* passwordlessPostLogin(_ref6) {
|
|
|
795
694
|
name: user.name
|
|
796
695
|
});
|
|
797
696
|
}
|
|
798
|
-
|
|
799
697
|
if (user.id) {
|
|
800
698
|
localStorage.setItem('userId', user.id);
|
|
801
699
|
}
|
|
802
|
-
|
|
803
700
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
804
701
|
user,
|
|
805
702
|
isAuthenticated: true
|
|
@@ -808,7 +705,6 @@ function* passwordlessPostLogin(_ref6) {
|
|
|
808
705
|
error: undefined
|
|
809
706
|
}));
|
|
810
707
|
yield (0, _effects.put)(_reducer.actions.loadTenants());
|
|
811
|
-
|
|
812
708
|
if (loginState.flow === _interfaces2.LoginFlow.Login) {
|
|
813
709
|
yield afterAuthNavigation();
|
|
814
710
|
} else {
|
|
@@ -816,13 +712,11 @@ function* passwordlessPostLogin(_ref6) {
|
|
|
816
712
|
preserveQueryParams: true
|
|
817
713
|
});
|
|
818
714
|
}
|
|
819
|
-
|
|
820
715
|
localStorage.removeItem('register-quick-login');
|
|
821
716
|
callback == null ? void 0 : callback(true);
|
|
822
717
|
}
|
|
823
718
|
} catch (e) {
|
|
824
719
|
var _e$message;
|
|
825
|
-
|
|
826
720
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
827
721
|
error: (_e$message = e.message) != null ? _e$message : 'Failed to authenticate'
|
|
828
722
|
}));
|
|
@@ -832,7 +726,6 @@ function* passwordlessPostLogin(_ref6) {
|
|
|
832
726
|
}));
|
|
833
727
|
}
|
|
834
728
|
}
|
|
835
|
-
|
|
836
729
|
function* verifyInviteToken({
|
|
837
730
|
payload
|
|
838
731
|
}) {
|
|
@@ -848,7 +741,6 @@ function* verifyInviteToken({
|
|
|
848
741
|
}));
|
|
849
742
|
} catch (e) {
|
|
850
743
|
var _e$message2;
|
|
851
|
-
|
|
852
744
|
console.error(e);
|
|
853
745
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
854
746
|
inviteTokenError: (_e$message2 = e.message) != null ? _e$message2 : `We couldn't verify your invitation`
|
|
@@ -859,7 +751,6 @@ function* verifyInviteToken({
|
|
|
859
751
|
}));
|
|
860
752
|
}
|
|
861
753
|
}
|
|
862
|
-
|
|
863
754
|
function* preLogin({
|
|
864
755
|
payload: {
|
|
865
756
|
email,
|
|
@@ -871,7 +762,6 @@ function* preLogin({
|
|
|
871
762
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
872
763
|
loading: true
|
|
873
764
|
}));
|
|
874
|
-
|
|
875
765
|
try {
|
|
876
766
|
const onRedirectTo = yield (0, _effects.select)(({
|
|
877
767
|
auth: {
|
|
@@ -884,7 +774,6 @@ function* preLogin({
|
|
|
884
774
|
} = yield (0, _effects.call)(_restApi.api.auth.preLoginV2, {
|
|
885
775
|
email
|
|
886
776
|
});
|
|
887
|
-
|
|
888
777
|
if (address) {
|
|
889
778
|
if (idpType === _interfaces4.SamlVendors.Oidc && !address.includes('redirect_uri')) {
|
|
890
779
|
const {
|
|
@@ -900,7 +789,6 @@ function* preLogin({
|
|
|
900
789
|
}));
|
|
901
790
|
address += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
|
|
902
791
|
}
|
|
903
|
-
|
|
904
792
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
905
793
|
step: _interfaces2.LoginStep.redirectToSSO,
|
|
906
794
|
loading: false,
|
|
@@ -928,12 +816,11 @@ function* preLogin({
|
|
|
928
816
|
});
|
|
929
817
|
}
|
|
930
818
|
}
|
|
931
|
-
|
|
932
819
|
function* ssoPreloginFailed(_ref7) {
|
|
933
820
|
let {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
821
|
+
callback
|
|
822
|
+
} = _ref7,
|
|
823
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref7, _excluded6);
|
|
937
824
|
const publicPolicy = yield (0, _effects.select)(({
|
|
938
825
|
auth: {
|
|
939
826
|
securityPolicyState: {
|
|
@@ -943,7 +830,6 @@ function* ssoPreloginFailed(_ref7) {
|
|
|
943
830
|
}
|
|
944
831
|
}
|
|
945
832
|
}) => publicPolicy);
|
|
946
|
-
|
|
947
833
|
if (!(publicPolicy != null && publicPolicy.authStrategy)) {
|
|
948
834
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
949
835
|
step: _interfaces2.LoginStep.loginWithPassword,
|
|
@@ -952,7 +838,6 @@ function* ssoPreloginFailed(_ref7) {
|
|
|
952
838
|
callback == null ? void 0 : callback();
|
|
953
839
|
return;
|
|
954
840
|
}
|
|
955
|
-
|
|
956
841
|
if ((publicPolicy == null ? void 0 : publicPolicy.authStrategy) === _restApi.AuthStrategyEnum.EmailAndPassword) {
|
|
957
842
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
958
843
|
step: _interfaces2.LoginStep.loginWithPassword,
|
|
@@ -972,7 +857,6 @@ function* ssoPreloginFailed(_ref7) {
|
|
|
972
857
|
callback == null ? void 0 : callback();
|
|
973
858
|
}
|
|
974
859
|
}
|
|
975
|
-
|
|
976
860
|
function* webAuthnCreateNewDeviceSession({
|
|
977
861
|
payload: {
|
|
978
862
|
callback
|
|
@@ -1000,15 +884,13 @@ function* webAuthnCreateNewDeviceSession({
|
|
|
1000
884
|
}));
|
|
1001
885
|
}
|
|
1002
886
|
}
|
|
1003
|
-
|
|
1004
887
|
function* webAuthnVerifyNewDeviceSession(_ref8) {
|
|
1005
888
|
let {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
889
|
+
payload: {
|
|
890
|
+
callback
|
|
891
|
+
}
|
|
892
|
+
} = _ref8,
|
|
893
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref8.payload, _excluded7);
|
|
1012
894
|
try {
|
|
1013
895
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1014
896
|
loading: true
|
|
@@ -1030,18 +912,15 @@ function* webAuthnVerifyNewDeviceSession(_ref8) {
|
|
|
1030
912
|
}));
|
|
1031
913
|
}
|
|
1032
914
|
}
|
|
1033
|
-
|
|
1034
915
|
function* webAuthnPrelogin(_ref9) {
|
|
1035
916
|
let {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
917
|
+
payload: {
|
|
918
|
+
callback
|
|
919
|
+
}
|
|
920
|
+
} = _ref9,
|
|
921
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref9.payload, _excluded8);
|
|
1042
922
|
try {
|
|
1043
923
|
var _options$allowCredent;
|
|
1044
|
-
|
|
1045
924
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1046
925
|
loading: true
|
|
1047
926
|
}));
|
|
@@ -1067,18 +946,15 @@ function* webAuthnPrelogin(_ref9) {
|
|
|
1067
946
|
}));
|
|
1068
947
|
}
|
|
1069
948
|
}
|
|
1070
|
-
|
|
1071
949
|
function* webAuthnPostLogin(_ref10) {
|
|
1072
950
|
let {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
951
|
+
payload: {
|
|
952
|
+
callback
|
|
953
|
+
}
|
|
954
|
+
} = _ref10,
|
|
955
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_ref10.payload, _excluded9);
|
|
1079
956
|
try {
|
|
1080
957
|
var _publicKey$response$u;
|
|
1081
|
-
|
|
1082
958
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1083
959
|
loading: true
|
|
1084
960
|
}));
|
|
@@ -1090,7 +966,6 @@ function* webAuthnPostLogin(_ref10) {
|
|
|
1090
966
|
recaptchaToken: body.recaptchaToken,
|
|
1091
967
|
invitationToken: body.invitationToken
|
|
1092
968
|
}));
|
|
1093
|
-
|
|
1094
969
|
if (isMfaRequired(data)) {
|
|
1095
970
|
const onRedirectTo = _restApi.ContextHolder.onRedirectTo;
|
|
1096
971
|
const {
|
|
@@ -1103,11 +978,9 @@ function* webAuthnPostLogin(_ref10) {
|
|
|
1103
978
|
});
|
|
1104
979
|
} else {
|
|
1105
980
|
const user = yield (0, _effects.call)(_restApi.api.auth.generateLoginResponse, data);
|
|
1106
|
-
|
|
1107
981
|
if (user.id) {
|
|
1108
982
|
localStorage.setItem('userId', user.id);
|
|
1109
983
|
}
|
|
1110
|
-
|
|
1111
984
|
yield (0, _effects.put)(_reducer.actions.loadTenants());
|
|
1112
985
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
1113
986
|
user,
|
|
@@ -1116,11 +989,11 @@ function* webAuthnPostLogin(_ref10) {
|
|
|
1116
989
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1117
990
|
error: undefined
|
|
1118
991
|
}));
|
|
1119
|
-
yield afterAuthNavigation();
|
|
1120
|
-
|
|
992
|
+
yield afterAuthNavigation();
|
|
993
|
+
// TODO: Itamar why moving callback to inside the else block
|
|
1121
994
|
callback == null ? void 0 : callback(true);
|
|
1122
|
-
}
|
|
1123
|
-
|
|
995
|
+
}
|
|
996
|
+
// callback?.(true);
|
|
1124
997
|
} catch (e) {
|
|
1125
998
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1126
999
|
error: e.message
|
|
@@ -1132,7 +1005,6 @@ function* webAuthnPostLogin(_ref10) {
|
|
|
1132
1005
|
}));
|
|
1133
1006
|
}
|
|
1134
1007
|
}
|
|
1135
|
-
|
|
1136
1008
|
function* postLogin({
|
|
1137
1009
|
payload
|
|
1138
1010
|
}) {
|
|
@@ -1151,14 +1023,10 @@ function* postLogin({
|
|
|
1151
1023
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1152
1024
|
loading: true
|
|
1153
1025
|
}));
|
|
1154
|
-
|
|
1155
1026
|
try {
|
|
1156
1027
|
const user = yield (0, _effects.call)(_restApi.api.auth.postLogin, payload);
|
|
1157
|
-
|
|
1158
1028
|
_restApi.ContextHolder.setAccessToken(user.accessToken);
|
|
1159
|
-
|
|
1160
1029
|
_restApi.ContextHolder.setUser(user);
|
|
1161
|
-
|
|
1162
1030
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
1163
1031
|
user: !!user.accessToken ? user : undefined,
|
|
1164
1032
|
isAuthenticated: !!user.accessToken
|
|
@@ -1174,7 +1042,6 @@ function* postLogin({
|
|
|
1174
1042
|
}));
|
|
1175
1043
|
}
|
|
1176
1044
|
}
|
|
1177
|
-
|
|
1178
1045
|
function* login({
|
|
1179
1046
|
payload: {
|
|
1180
1047
|
email,
|
|
@@ -1187,7 +1054,6 @@ function* login({
|
|
|
1187
1054
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1188
1055
|
loading: true
|
|
1189
1056
|
}));
|
|
1190
|
-
|
|
1191
1057
|
try {
|
|
1192
1058
|
const user = yield (0, _effects.call)(_restApi.api.auth.login, {
|
|
1193
1059
|
email,
|
|
@@ -1195,16 +1061,12 @@ function* login({
|
|
|
1195
1061
|
recaptchaToken,
|
|
1196
1062
|
invitationToken
|
|
1197
1063
|
});
|
|
1198
|
-
|
|
1199
1064
|
_restApi.ContextHolder.setAccessToken(user.accessToken);
|
|
1200
|
-
|
|
1201
1065
|
_restApi.ContextHolder.setUser(user);
|
|
1202
|
-
|
|
1203
1066
|
const onRedirectTo = _restApi.ContextHolder.onRedirectTo;
|
|
1204
1067
|
const {
|
|
1205
1068
|
routes
|
|
1206
1069
|
} = yield (0, _effects.select)(state => state.auth);
|
|
1207
|
-
|
|
1208
1070
|
if (isMfaRequired(user)) {
|
|
1209
1071
|
const mfaRequiredState = yield getMfaRequiredState(user);
|
|
1210
1072
|
yield (0, _effects.put)(_reducer.actions.setState(mfaRequiredState));
|
|
@@ -1216,11 +1078,9 @@ function* login({
|
|
|
1216
1078
|
loginState
|
|
1217
1079
|
} = yield (0, _effects.select)(state => state.auth);
|
|
1218
1080
|
const isAuthenticated = !!user.accessToken;
|
|
1219
|
-
|
|
1220
1081
|
if (user.id) {
|
|
1221
1082
|
localStorage.setItem('userId', user.id);
|
|
1222
1083
|
}
|
|
1223
|
-
|
|
1224
1084
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
1225
1085
|
user,
|
|
1226
1086
|
isAuthenticated,
|
|
@@ -1237,20 +1097,17 @@ function* login({
|
|
|
1237
1097
|
}
|
|
1238
1098
|
}));
|
|
1239
1099
|
yield (0, _effects.put)(_reducer.actions.loadTenants());
|
|
1240
|
-
|
|
1241
1100
|
if (isAuthenticated && loginState.flow === _interfaces2.LoginFlow.Login) {
|
|
1242
1101
|
yield afterAuthNavigation();
|
|
1243
1102
|
}
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1103
|
+
}
|
|
1246
1104
|
|
|
1105
|
+
// TODO: extract item name to constants
|
|
1247
1106
|
localStorage.removeItem('register-quick-login');
|
|
1248
1107
|
callback == null ? void 0 : callback(true);
|
|
1249
1108
|
} catch (e) {
|
|
1250
1109
|
_restApi.ContextHolder.setAccessToken(null);
|
|
1251
|
-
|
|
1252
1110
|
_restApi.ContextHolder.setUser(null);
|
|
1253
|
-
|
|
1254
1111
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1255
1112
|
email,
|
|
1256
1113
|
error: e.message,
|
|
@@ -1258,7 +1115,6 @@ function* login({
|
|
|
1258
1115
|
}));
|
|
1259
1116
|
}
|
|
1260
1117
|
}
|
|
1261
|
-
|
|
1262
1118
|
function* loginWithMfa({
|
|
1263
1119
|
payload: {
|
|
1264
1120
|
mfaToken,
|
|
@@ -1270,7 +1126,6 @@ function* loginWithMfa({
|
|
|
1270
1126
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1271
1127
|
loading: true
|
|
1272
1128
|
}));
|
|
1273
|
-
|
|
1274
1129
|
try {
|
|
1275
1130
|
const user = yield (0, _effects.call)(_restApi.api.auth.loginWithMfa, {
|
|
1276
1131
|
mfaToken,
|
|
@@ -1294,21 +1149,17 @@ function* loginWithMfa({
|
|
|
1294
1149
|
user,
|
|
1295
1150
|
isAuthenticated: true
|
|
1296
1151
|
}));
|
|
1297
|
-
|
|
1298
1152
|
if (user.id) {
|
|
1299
1153
|
localStorage.setItem('userId', user.id);
|
|
1300
1154
|
}
|
|
1301
|
-
|
|
1302
1155
|
yield (0, _effects.put)(_reducer.actions.loadTenants());
|
|
1303
1156
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1304
1157
|
error: undefined,
|
|
1305
1158
|
loading: false
|
|
1306
1159
|
}));
|
|
1307
|
-
|
|
1308
1160
|
if (loginState.flow === _interfaces2.LoginFlow.Login) {
|
|
1309
1161
|
yield afterAuthNavigation();
|
|
1310
1162
|
}
|
|
1311
|
-
|
|
1312
1163
|
callback == null ? void 0 : callback(true);
|
|
1313
1164
|
} catch (e) {
|
|
1314
1165
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
@@ -1318,14 +1169,12 @@ function* loginWithMfa({
|
|
|
1318
1169
|
callback == null ? void 0 : callback(false, e);
|
|
1319
1170
|
}
|
|
1320
1171
|
}
|
|
1321
|
-
|
|
1322
1172
|
function* recoverMfa({
|
|
1323
1173
|
payload
|
|
1324
1174
|
}) {
|
|
1325
1175
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1326
1176
|
loading: true
|
|
1327
1177
|
}));
|
|
1328
|
-
|
|
1329
1178
|
try {
|
|
1330
1179
|
yield (0, _effects.call)(_restApi.api.auth.recoverMfaToken, payload);
|
|
1331
1180
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
@@ -1344,7 +1193,6 @@ function* recoverMfa({
|
|
|
1344
1193
|
}));
|
|
1345
1194
|
}
|
|
1346
1195
|
}
|
|
1347
|
-
|
|
1348
1196
|
function* logout({
|
|
1349
1197
|
payload
|
|
1350
1198
|
}) {
|
|
@@ -1354,7 +1202,6 @@ function* logout({
|
|
|
1354
1202
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
1355
1203
|
isLoading: true
|
|
1356
1204
|
}));
|
|
1357
|
-
|
|
1358
1205
|
try {
|
|
1359
1206
|
if (hostedLoginBox) {
|
|
1360
1207
|
yield (0, _effects.call)(_restApi.api.auth.OAuthLogout);
|
|
@@ -1362,28 +1209,22 @@ function* logout({
|
|
|
1362
1209
|
yield (0, _effects.call)(_restApi.api.auth.logout);
|
|
1363
1210
|
}
|
|
1364
1211
|
} catch {}
|
|
1365
|
-
|
|
1366
1212
|
yield (0, _effects.put)(_reducer.actions.resetState());
|
|
1367
1213
|
yield (0, _effects.put)(_reducer.actions.requestAuthorize(true));
|
|
1368
1214
|
payload == null ? void 0 : payload();
|
|
1369
1215
|
}
|
|
1370
|
-
|
|
1371
1216
|
function* silentLogout({
|
|
1372
1217
|
payload
|
|
1373
1218
|
}) {
|
|
1374
1219
|
var _payload$callbackTime;
|
|
1375
|
-
|
|
1376
1220
|
try {
|
|
1377
1221
|
yield (0, _effects.call)(_restApi.api.auth.logout);
|
|
1378
1222
|
} catch {}
|
|
1379
|
-
|
|
1380
1223
|
setTimeout(() => {
|
|
1381
1224
|
var _payload$callback;
|
|
1382
|
-
|
|
1383
1225
|
return payload == null ? void 0 : (_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
|
|
1384
1226
|
}, (_payload$callbackTime = payload == null ? void 0 : payload.callbackTimeout) != null ? _payload$callbackTime : 500);
|
|
1385
1227
|
}
|
|
1386
|
-
|
|
1387
1228
|
function* handleEnrollMFAResponse({
|
|
1388
1229
|
user,
|
|
1389
1230
|
tenants
|
|
@@ -1394,23 +1235,19 @@ function* handleEnrollMFAResponse({
|
|
|
1394
1235
|
error: undefined,
|
|
1395
1236
|
saving: false
|
|
1396
1237
|
};
|
|
1397
|
-
|
|
1398
1238
|
if (user != null && user.recoveryCode) {
|
|
1399
1239
|
mfaState.recoveryCode = user.recoveryCode;
|
|
1400
1240
|
}
|
|
1401
|
-
|
|
1402
1241
|
yield (0, _effects.put)(_reducer.actions.setMfaState(mfaState));
|
|
1403
1242
|
yield (0, _effects.put)(_reducer.actions.setUser(user));
|
|
1404
1243
|
yield (0, _effects.put)(_reducer.actions.setTenantsState({
|
|
1405
1244
|
tenants,
|
|
1406
1245
|
loading: false
|
|
1407
1246
|
}));
|
|
1408
|
-
|
|
1409
1247
|
if (user.id) {
|
|
1410
1248
|
localStorage.setItem('userId', user.id);
|
|
1411
1249
|
}
|
|
1412
1250
|
}
|
|
1413
|
-
|
|
1414
1251
|
function* handleVerifyMFAResponse({
|
|
1415
1252
|
user,
|
|
1416
1253
|
tenants
|
|
@@ -1423,31 +1260,26 @@ function* handleVerifyMFAResponse({
|
|
|
1423
1260
|
tenants,
|
|
1424
1261
|
loading: false
|
|
1425
1262
|
}));
|
|
1426
|
-
|
|
1427
1263
|
if (user.id) {
|
|
1428
1264
|
localStorage.setItem('userId', user.id);
|
|
1429
1265
|
}
|
|
1430
|
-
|
|
1431
1266
|
if (loginState.flow === _interfaces2.LoginFlow.Login) {
|
|
1432
1267
|
yield afterAuthNavigation();
|
|
1433
1268
|
}
|
|
1434
|
-
|
|
1435
1269
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
1436
1270
|
isAuthenticated: true
|
|
1437
1271
|
}));
|
|
1438
1272
|
}
|
|
1439
|
-
|
|
1440
1273
|
function* preEnrollMFASMSForLogin(_ref11) {
|
|
1441
1274
|
let {
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1275
|
+
payload: {
|
|
1276
|
+
callback
|
|
1277
|
+
}
|
|
1278
|
+
} = _ref11,
|
|
1279
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref11.payload, _excluded10);
|
|
1447
1280
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1448
1281
|
loading: true
|
|
1449
1282
|
}));
|
|
1450
|
-
|
|
1451
1283
|
try {
|
|
1452
1284
|
const data = yield (0, _effects.call)(_restApi.api.auth.preEnrollMFASMSForLogin, payload);
|
|
1453
1285
|
yield (0, _effects.put)(_reducer.actions.setMfaState({
|
|
@@ -1467,18 +1299,16 @@ function* preEnrollMFASMSForLogin(_ref11) {
|
|
|
1467
1299
|
callback == null ? void 0 : callback(null);
|
|
1468
1300
|
}
|
|
1469
1301
|
}
|
|
1470
|
-
|
|
1471
1302
|
function* enrollMFASMSForLogin(_ref12) {
|
|
1472
1303
|
let {
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1304
|
+
payload: {
|
|
1305
|
+
callback
|
|
1306
|
+
}
|
|
1307
|
+
} = _ref12,
|
|
1308
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref12.payload, _excluded11);
|
|
1478
1309
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1479
1310
|
loading: true
|
|
1480
1311
|
}));
|
|
1481
|
-
|
|
1482
1312
|
try {
|
|
1483
1313
|
const data = yield (0, _effects.call)(_restApi.api.auth.enrollMFASMSForLogin, payload);
|
|
1484
1314
|
const response = yield (0, _effects.call)(_restApi.api.auth.generateLoginResponseV2, data);
|
|
@@ -1495,21 +1325,18 @@ function* enrollMFASMSForLogin(_ref12) {
|
|
|
1495
1325
|
callback == null ? void 0 : callback(null);
|
|
1496
1326
|
}
|
|
1497
1327
|
}
|
|
1498
|
-
|
|
1499
1328
|
function* preEnrollMFAWebAuthnForLogin(_ref13) {
|
|
1500
1329
|
let {
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1330
|
+
payload: {
|
|
1331
|
+
callback
|
|
1332
|
+
}
|
|
1333
|
+
} = _ref13,
|
|
1334
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref13.payload, _excluded12);
|
|
1506
1335
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1507
1336
|
loading: true
|
|
1508
1337
|
}));
|
|
1509
|
-
|
|
1510
1338
|
try {
|
|
1511
1339
|
var _data$options$exclude;
|
|
1512
|
-
|
|
1513
1340
|
const data = yield (0, _effects.call)(_restApi.api.auth.preEnrollMFAWebAuthnForLogin, payload);
|
|
1514
1341
|
const options = (0, _extends2.default)({}, data.options, {
|
|
1515
1342
|
challenge: (0, _utils.base64urlDecode)(data.options.challenge),
|
|
@@ -1535,18 +1362,16 @@ function* preEnrollMFAWebAuthnForLogin(_ref13) {
|
|
|
1535
1362
|
callback == null ? void 0 : callback(null);
|
|
1536
1363
|
}
|
|
1537
1364
|
}
|
|
1538
|
-
|
|
1539
1365
|
function* enrollMFAWebAuthnForLogin(_ref14) {
|
|
1540
1366
|
let {
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1367
|
+
payload: {
|
|
1368
|
+
callback
|
|
1369
|
+
}
|
|
1370
|
+
} = _ref14,
|
|
1371
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref14.payload, _excluded13);
|
|
1546
1372
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1547
1373
|
loading: true
|
|
1548
1374
|
}));
|
|
1549
|
-
|
|
1550
1375
|
try {
|
|
1551
1376
|
const publicKey = (0, _utils.publicKeyCredentialToJSON)(payload.publicKey);
|
|
1552
1377
|
const data = yield (0, _effects.call)(_restApi.api.auth.enrollMFAWebAuthnForLogin, (0, _extends2.default)({}, payload, {
|
|
@@ -1566,18 +1391,16 @@ function* enrollMFAWebAuthnForLogin(_ref14) {
|
|
|
1566
1391
|
callback == null ? void 0 : callback(null);
|
|
1567
1392
|
}
|
|
1568
1393
|
}
|
|
1569
|
-
|
|
1570
1394
|
function* enrollMFAAuthenticatorAppForLogin(_ref15) {
|
|
1571
1395
|
let {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1396
|
+
payload: {
|
|
1397
|
+
callback
|
|
1398
|
+
}
|
|
1399
|
+
} = _ref15,
|
|
1400
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref15.payload, _excluded14);
|
|
1577
1401
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1578
1402
|
loading: true
|
|
1579
1403
|
}));
|
|
1580
|
-
|
|
1581
1404
|
try {
|
|
1582
1405
|
const data = yield (0, _effects.call)(_restApi.api.auth.enrollMFAAuthenticatorAppForLogin, payload);
|
|
1583
1406
|
const response = yield (0, _effects.call)(_restApi.api.auth.generateLoginResponseV2, data);
|
|
@@ -1594,19 +1417,17 @@ function* enrollMFAAuthenticatorAppForLogin(_ref15) {
|
|
|
1594
1417
|
callback == null ? void 0 : callback(null);
|
|
1595
1418
|
}
|
|
1596
1419
|
}
|
|
1597
|
-
|
|
1598
1420
|
function* preVerifyMFASMSForLogin(_ref16) {
|
|
1599
1421
|
let {
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1422
|
+
payload: {
|
|
1423
|
+
callback,
|
|
1424
|
+
deviceId
|
|
1425
|
+
}
|
|
1426
|
+
} = _ref16,
|
|
1427
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref16.payload, _excluded15);
|
|
1606
1428
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1607
1429
|
loading: true
|
|
1608
1430
|
}));
|
|
1609
|
-
|
|
1610
1431
|
try {
|
|
1611
1432
|
const data = yield (0, _effects.call)(_restApi.api.auth.preVerifyMFASMSForLogin, deviceId, payload);
|
|
1612
1433
|
yield (0, _effects.put)(_reducer.actions.setMfaState({
|
|
@@ -1626,19 +1447,17 @@ function* preVerifyMFASMSForLogin(_ref16) {
|
|
|
1626
1447
|
callback == null ? void 0 : callback(null);
|
|
1627
1448
|
}
|
|
1628
1449
|
}
|
|
1629
|
-
|
|
1630
1450
|
function* verifyMFASMSForLogin(_ref17) {
|
|
1631
1451
|
let {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1452
|
+
payload: {
|
|
1453
|
+
callback,
|
|
1454
|
+
deviceId
|
|
1455
|
+
}
|
|
1456
|
+
} = _ref17,
|
|
1457
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref17.payload, _excluded16);
|
|
1638
1458
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1639
1459
|
loading: true
|
|
1640
1460
|
}));
|
|
1641
|
-
|
|
1642
1461
|
try {
|
|
1643
1462
|
const data = yield (0, _effects.call)(_restApi.api.auth.verifyMFASMSForLogin, deviceId, payload);
|
|
1644
1463
|
const response = yield (0, _effects.call)(_restApi.api.auth.generateLoginResponseV2, data);
|
|
@@ -1655,22 +1474,19 @@ function* verifyMFASMSForLogin(_ref17) {
|
|
|
1655
1474
|
callback == null ? void 0 : callback(null);
|
|
1656
1475
|
}
|
|
1657
1476
|
}
|
|
1658
|
-
|
|
1659
1477
|
function* preVerifyMFAWebAuthnForLogin(_ref18) {
|
|
1660
1478
|
let {
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1479
|
+
payload: {
|
|
1480
|
+
callback,
|
|
1481
|
+
deviceId
|
|
1482
|
+
}
|
|
1483
|
+
} = _ref18,
|
|
1484
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref18.payload, _excluded17);
|
|
1667
1485
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1668
1486
|
loading: true
|
|
1669
1487
|
}));
|
|
1670
|
-
|
|
1671
1488
|
try {
|
|
1672
1489
|
var _data$options$allowCr;
|
|
1673
|
-
|
|
1674
1490
|
const data = yield (0, _effects.call)(_restApi.api.auth.preVerifyMFAWebAuthnForLogin, deviceId, payload);
|
|
1675
1491
|
const options = (0, _extends2.default)({}, data.options, {
|
|
1676
1492
|
challenge: (0, _utils.base64urlDecode)(data.options.challenge),
|
|
@@ -1693,19 +1509,17 @@ function* preVerifyMFAWebAuthnForLogin(_ref18) {
|
|
|
1693
1509
|
callback == null ? void 0 : callback(null);
|
|
1694
1510
|
}
|
|
1695
1511
|
}
|
|
1696
|
-
|
|
1697
1512
|
function* verifyMFAWebAuthnForLogin(_ref19) {
|
|
1698
1513
|
let {
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1514
|
+
payload: {
|
|
1515
|
+
callback,
|
|
1516
|
+
deviceId
|
|
1517
|
+
}
|
|
1518
|
+
} = _ref19,
|
|
1519
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref19.payload, _excluded18);
|
|
1705
1520
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
1706
1521
|
loading: true
|
|
1707
1522
|
}));
|
|
1708
|
-
|
|
1709
1523
|
try {
|
|
1710
1524
|
const publicKey = (0, _utils.publicKeyCredentialToJSON)(payload.publicKey);
|
|
1711
1525
|
const data = yield (0, _effects.call)(_restApi.api.auth.verifyMFAWebAuthnForLogin, deviceId, (0, _extends2.default)({}, payload, {
|
|
@@ -1725,7 +1539,6 @@ function* verifyMFAWebAuthnForLogin(_ref19) {
|
|
|
1725
1539
|
callback == null ? void 0 : callback(null);
|
|
1726
1540
|
}
|
|
1727
1541
|
}
|
|
1728
|
-
|
|
1729
1542
|
function* loginSagas() {
|
|
1730
1543
|
yield (0, _effects.takeLeading)(_reducer.actions.requestAuthorize, requestAuthorize);
|
|
1731
1544
|
yield (0, _effects.takeLeading)(_reducer.actions.requestAuthorizeSSR, requestAuthorizeSSR);
|
|
@@ -1760,11 +1573,11 @@ function* loginSagas() {
|
|
|
1760
1573
|
yield (0, _effects.takeLeading)(_reducer.actions.preVerifyMFAWebAuthnForLogin, preVerifyMFAWebAuthnForLogin);
|
|
1761
1574
|
yield (0, _effects.takeLeading)(_reducer.actions.verifyMFAWebAuthnForLogin, verifyMFAWebAuthnForLogin);
|
|
1762
1575
|
}
|
|
1576
|
+
|
|
1763
1577
|
/*********************************
|
|
1764
1578
|
* Preview Sagas
|
|
1765
1579
|
*********************************/
|
|
1766
1580
|
|
|
1767
|
-
|
|
1768
1581
|
function* requestAuthorizeMock({
|
|
1769
1582
|
payload: firstTime
|
|
1770
1583
|
}) {
|
|
@@ -1773,7 +1586,6 @@ function* requestAuthorizeMock({
|
|
|
1773
1586
|
isLoading: true
|
|
1774
1587
|
}));
|
|
1775
1588
|
}
|
|
1776
|
-
|
|
1777
1589
|
const user = _dummy.userDemo;
|
|
1778
1590
|
yield (0, _effects.put)(_reducer.actions.loadTenants());
|
|
1779
1591
|
yield (0, _effects.put)(_reducer.actions.setState({
|
|
@@ -1782,7 +1594,6 @@ function* requestAuthorizeMock({
|
|
|
1782
1594
|
isLoading: false
|
|
1783
1595
|
}));
|
|
1784
1596
|
}
|
|
1785
|
-
|
|
1786
1597
|
function* getUserIPMock({
|
|
1787
1598
|
payload: {
|
|
1788
1599
|
callback
|
|
@@ -1800,7 +1611,6 @@ function* getUserIPMock({
|
|
|
1800
1611
|
callback == null ? void 0 : callback(false, e);
|
|
1801
1612
|
}
|
|
1802
1613
|
}
|
|
1803
|
-
|
|
1804
1614
|
function* loginSagasMock() {
|
|
1805
1615
|
yield (0, _effects.takeLeading)(_reducer.actions.requestAuthorize, requestAuthorizeMock);
|
|
1806
1616
|
yield (0, _effects.takeLeading)(_reducer.actions.afterAuthNavigation, afterAuthNavigation);
|