auth0-lock 11.34.1 → 12.0.0-beta.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/.browserslistrc +1 -0
- package/.circleci/config.yml +4 -2
- package/.eslintrc.json +5 -5
- package/.github/workflows/codeql.yml +41 -0
- package/.shiprc +4 -5
- package/CHANGELOG.md +32 -0
- package/EXAMPLES.md +626 -0
- package/README.md +77 -649
- package/karma.conf.js +1 -1
- package/lib/CSSCore.js +1 -4
- package/lib/__tests__/auth_button.js +12 -22
- package/lib/__tests__/connection/database/actions.js +48 -49
- package/lib/__tests__/connection/database/index.js +22 -28
- package/lib/__tests__/connection/database/login_pane.js +20 -41
- package/lib/__tests__/connection/database/password_reset_confirmation.js +19 -26
- package/lib/__tests__/connection/database/reset_password.js +17 -39
- package/lib/__tests__/connection/database/signed_up_confirmation.js +19 -26
- package/lib/__tests__/connection/enterprise/actions.js +22 -47
- package/lib/__tests__/connection/enterprise/hrd_pane.js +16 -33
- package/lib/__tests__/connection/enterprise/hrd_screen.js +26 -40
- package/lib/__tests__/connection/enterprise/quick_auth_screen.js +27 -68
- package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +19 -26
- package/lib/__tests__/connection/passwordless/passwordless.js +35 -97
- package/lib/__tests__/core/actions.js +23 -46
- package/lib/__tests__/core/client/index.js +10 -13
- package/lib/__tests__/core/index.js +46 -94
- package/lib/__tests__/core/remote_data.js +14 -20
- package/lib/__tests__/core/signed_in_confirmation.js +19 -26
- package/lib/__tests__/core/sso/last_login_screen.js +27 -50
- package/lib/__tests__/core/tenant.js +10 -12
- package/lib/__tests__/core/web_api/helper.js +6 -14
- package/lib/__tests__/core/web_api/p2_api.js +38 -33
- package/lib/__tests__/core/web_api.js +37 -33
- package/lib/__tests__/engine/classic/login.js +20 -41
- package/lib/__tests__/engine/classic/mfa_login_screen.js +6 -19
- package/lib/__tests__/engine/classic/sign_up_pane.js +33 -55
- package/lib/__tests__/engine/classic/sign_up_screen.js +18 -45
- package/lib/__tests__/engine/classic.js +13 -6
- package/lib/__tests__/engine/passwordless.js +2 -5
- package/lib/__tests__/field/captcha/recaptcha_enterprise.js +27 -27
- package/lib/__tests__/field/captcha/recaptchav2.js +27 -27
- package/lib/__tests__/field/captcha.js +39 -51
- package/lib/__tests__/field/custom_input.js +23 -47
- package/lib/__tests__/field/email.js +2 -3
- package/lib/__tests__/field/email_pane.js +25 -48
- package/lib/__tests__/field/field.js +9 -13
- package/lib/__tests__/field/login_pane.js +30 -34
- package/lib/__tests__/field/mfa_code_pane.js +13 -28
- package/lib/__tests__/field/option_selection_pane.js +7 -25
- package/lib/__tests__/field/password.js +6 -12
- package/lib/__tests__/field/password_pane.js +29 -46
- package/lib/__tests__/field/phone_number_pane.js +18 -41
- package/lib/__tests__/field/social_buttons_pane.js +30 -47
- package/lib/__tests__/field/username.js +27 -48
- package/lib/__tests__/field/username_pane.js +30 -47
- package/lib/__tests__/field/vcode.js +5 -13
- package/lib/__tests__/field/vcode_pane.js +20 -44
- package/lib/__tests__/i18n.js +28 -53
- package/lib/__tests__/quick-auth/actions.js +4 -27
- package/lib/__tests__/setup-tests.js +7 -9
- package/lib/__tests__/testUtils.js +41 -58
- package/lib/__tests__/ui/box/chrome.js +24 -49
- package/lib/__tests__/ui/box/confirmation_pane.js +19 -36
- package/lib/__tests__/ui/box/container.js +21 -46
- package/lib/__tests__/ui/box/global_message.js +60 -37
- package/lib/__tests__/ui/input/email_input.js +6 -17
- package/lib/__tests__/ui/input/input_wrap.js +6 -19
- package/lib/__tests__/ui/input/password/password_strength.js +13 -15
- package/lib/__tests__/ui/input/password_input.js +22 -27
- package/lib/__tests__/utils/format.js +10 -17
- package/lib/__tests__/utils/url_utils.js +2 -5
- package/lib/avatar/gravatar_provider.js +13 -28
- package/lib/avatar.js +22 -41
- package/lib/browser.js +372 -23
- package/lib/connection/captcha.js +14 -32
- package/lib/connection/database/actions.js +39 -108
- package/lib/connection/database/index.js +90 -191
- package/lib/connection/database/login_pane.js +107 -147
- package/lib/connection/database/login_sign_up_tabs.js +106 -125
- package/lib/connection/database/mfa_pane.js +50 -69
- package/lib/connection/database/password_reset_confirmation.js +51 -73
- package/lib/connection/database/reset_password.js +116 -132
- package/lib/connection/database/reset_password_pane.js +45 -56
- package/lib/connection/database/sign_up_terms.js +17 -23
- package/lib/connection/database/signed_up_confirmation.js +52 -75
- package/lib/connection/enterprise/actions.js +23 -52
- package/lib/connection/enterprise/hrd_pane.js +60 -76
- package/lib/connection/enterprise/hrd_screen.js +60 -75
- package/lib/connection/enterprise/kerberos_screen.js +46 -60
- package/lib/connection/enterprise/quick_auth_screen.js +46 -64
- package/lib/connection/enterprise/single_sign_on_notice.js +14 -26
- package/lib/connection/enterprise.js +51 -84
- package/lib/connection/passwordless/actions.js +29 -62
- package/lib/connection/passwordless/ask_vcode.js +53 -60
- package/lib/connection/passwordless/email_sent_confirmation.js +129 -179
- package/lib/connection/passwordless/index.js +36 -68
- package/lib/connection/social/index.js +12 -15
- package/lib/core/actions.js +33 -85
- package/lib/core/client/index.js +38 -58
- package/lib/core/client/settings.js +12 -20
- package/lib/core/error_screen.js +38 -52
- package/lib/core/index.js +152 -301
- package/lib/core/loading_screen.js +61 -71
- package/lib/core/pane_separator.js +10 -10
- package/lib/core/remote_data.js +28 -48
- package/lib/core/screen.js +85 -79
- package/lib/core/signed_in_confirmation.js +51 -73
- package/lib/core/sso/data.js +9 -17
- package/lib/core/sso/index.js +5 -6
- package/lib/core/sso/last_login_screen.js +46 -63
- package/lib/core/tenant/index.js +37 -59
- package/lib/core/tenant/settings.js +11 -15
- package/lib/core/web_api/helper.js +24 -30
- package/lib/core/web_api/p2_api.js +156 -165
- package/lib/core/web_api.js +101 -90
- package/lib/core.js +126 -160
- package/lib/engine/classic/login.js +92 -144
- package/lib/engine/classic/mfa_login_screen.js +61 -67
- package/lib/engine/classic/sign_up_pane.js +89 -123
- package/lib/engine/classic/sign_up_screen.js +112 -158
- package/lib/engine/classic.js +122 -183
- package/lib/engine/passwordless/social_or_email_login_screen.js +71 -106
- package/lib/engine/passwordless/social_or_phone_number_login_screen.js +70 -100
- package/lib/engine/passwordless.js +75 -104
- package/lib/field/actions.js +11 -17
- package/lib/field/captcha/captcha_pane.js +82 -102
- package/lib/field/captcha/recaptcha.js +140 -145
- package/lib/field/captcha.js +7 -10
- package/lib/field/custom_input.js +37 -50
- package/lib/field/email/email_pane.js +90 -109
- package/lib/field/email.js +17 -35
- package/lib/field/index.js +51 -88
- package/lib/field/mfa-code/mfa_code_pane.js +57 -71
- package/lib/field/mfa_code.js +15 -21
- package/lib/field/option_selection_pane.js +16 -22
- package/lib/field/password/password_pane.js +79 -91
- package/lib/field/password.js +8 -14
- package/lib/field/phone-number/locations.js +7 -3
- package/lib/field/phone-number/phone_number_pane.js +87 -124
- package/lib/field/phone_number.js +16 -30
- package/lib/field/social/event.js +9 -12
- package/lib/field/social/social_buttons_pane.js +93 -121
- package/lib/field/username/username_pane.js +105 -123
- package/lib/field/username.js +16 -26
- package/lib/field/vcode/vcode_pane.js +67 -93
- package/lib/field/vcode.js +5 -5
- package/lib/i18n/af.js +7 -4
- package/lib/i18n/ar.js +7 -4
- package/lib/i18n/az.js +7 -4
- package/lib/i18n/bg.js +7 -4
- package/lib/i18n/ca.js +7 -4
- package/lib/i18n/cs.js +7 -4
- package/lib/i18n/da.js +7 -4
- package/lib/i18n/de.js +7 -3
- package/lib/i18n/el.js +7 -4
- package/lib/i18n/en.js +9 -4
- package/lib/i18n/es.js +7 -3
- package/lib/i18n/et.js +7 -4
- package/lib/i18n/fa.js +7 -4
- package/lib/i18n/fi.js +7 -4
- package/lib/i18n/fr.js +7 -4
- package/lib/i18n/he.js +7 -4
- package/lib/i18n/hr.js +7 -4
- package/lib/i18n/hu.js +7 -4
- package/lib/i18n/id.js +7 -4
- package/lib/i18n/it.js +7 -3
- package/lib/i18n/ja.js +7 -4
- package/lib/i18n/ko.js +7 -4
- package/lib/i18n/lt.js +7 -4
- package/lib/i18n/lv.js +7 -4
- package/lib/i18n/ms.js +7 -4
- package/lib/i18n/nb.js +7 -4
- package/lib/i18n/nl.js +7 -4
- package/lib/i18n/nn.js +7 -4
- package/lib/i18n/no.js +7 -4
- package/lib/i18n/pl.js +7 -4
- package/lib/i18n/pt-br.js +7 -3
- package/lib/i18n/pt.js +7 -4
- package/lib/i18n/ro.js +7 -4
- package/lib/i18n/ru.js +7 -4
- package/lib/i18n/sk.js +7 -4
- package/lib/i18n/sl.js +7 -4
- package/lib/i18n/sr.js +7 -4
- package/lib/i18n/sv.js +7 -4
- package/lib/i18n/tr.js +7 -4
- package/lib/i18n/ua.js +7 -4
- package/lib/i18n/uk.js +7 -4
- package/lib/i18n/vi.js +7 -4
- package/lib/i18n/zh-tw.js +7 -4
- package/lib/i18n/zh.js +7 -4
- package/lib/i18n.js +38 -75
- package/lib/index.js +14 -17
- package/lib/lock.js +29 -32
- package/lib/passwordless.js +29 -31
- package/lib/quick-auth/actions.js +19 -26
- package/lib/quick_auth.js +8 -10
- package/lib/sanitizer.js +5 -5
- package/lib/store/index.js +22 -42
- package/lib/sync.js +21 -42
- package/lib/ui/box/button.js +85 -105
- package/lib/ui/box/chrome.js +463 -548
- package/lib/ui/box/confirmation_pane.js +34 -48
- package/lib/ui/box/container.js +305 -339
- package/lib/ui/box/global_message.js +51 -60
- package/lib/ui/box/header.js +155 -177
- package/lib/ui/box/multisize_slide.js +233 -229
- package/lib/ui/box/success_pane.js +34 -37
- package/lib/ui/box.js +88 -93
- package/lib/ui/button/auth_button.js +44 -51
- package/lib/ui/input/captcha_input.js +162 -181
- package/lib/ui/input/checkbox_input.js +57 -59
- package/lib/ui/input/email_input.js +117 -124
- package/lib/ui/input/input_wrap.js +65 -80
- package/lib/ui/input/location_input.js +130 -150
- package/lib/ui/input/mfa_code_input.js +98 -98
- package/lib/ui/input/password/password_strength.js +103 -127
- package/lib/ui/input/password_input.js +141 -147
- package/lib/ui/input/phone_number_input.js +101 -109
- package/lib/ui/input/select_input.js +120 -132
- package/lib/ui/input/text_input.js +89 -84
- package/lib/ui/input/username_input.js +109 -115
- package/lib/ui/input/vcode_input.js +110 -118
- package/lib/ui/list.js +224 -247
- package/lib/ui/pane/quick_auth_pane.js +55 -80
- package/lib/utils/atom.js +55 -48
- package/lib/utils/cache.js +54 -43
- package/lib/utils/cdn_utils.js +17 -31
- package/lib/utils/createRef.js +3 -1
- package/lib/utils/data_utils.js +10 -16
- package/lib/utils/fn_utils.js +5 -4
- package/lib/utils/format.js +6 -8
- package/lib/utils/id_utils.js +4 -3
- package/lib/utils/jsonp_utils.js +20 -17
- package/lib/utils/media_utils.js +4 -2
- package/lib/utils/preload_utils.js +4 -3
- package/lib/utils/string_utils.js +4 -4
- package/lib/utils/url_utils.js +4 -3
- package/opslevel.yml +6 -0
- package/package.json +53 -38
- package/webpack.config.js +36 -3
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _immutable = require('immutable');
|
|
4
|
-
|
|
5
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
6
|
-
|
|
7
|
-
var _actions = require('connection/passwordless/actions');
|
|
8
|
-
|
|
9
|
-
var _actions2 = _interopRequireDefault(_actions);
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
4
|
+
var _actions = _interopRequireDefault(require("connection/passwordless/actions"));
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
7
|
jest.useFakeTimers();
|
|
16
|
-
|
|
17
8
|
describe('passwordless actions', function () {
|
|
18
|
-
var mockFns
|
|
19
|
-
var actions
|
|
9
|
+
var mockFns;
|
|
10
|
+
var actions;
|
|
20
11
|
beforeEach(function () {
|
|
21
12
|
jest.resetModules();
|
|
22
|
-
|
|
23
13
|
jest.mock('connection/passwordless/index', function () {
|
|
24
14
|
return {
|
|
25
15
|
isEmail: jest.fn(),
|
|
@@ -64,9 +54,11 @@ describe('passwordless actions', function () {
|
|
|
64
54
|
};
|
|
65
55
|
});
|
|
66
56
|
jest.mock('i18n', function () {
|
|
67
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
html: function html(_, keys) {
|
|
68
59
|
return keys.join(',');
|
|
69
|
-
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
70
62
|
});
|
|
71
63
|
jest.mock('core/index', function () {
|
|
72
64
|
return {
|
|
@@ -104,11 +96,9 @@ describe('passwordless actions', function () {
|
|
|
104
96
|
updateEntity: 'updateEntity'
|
|
105
97
|
};
|
|
106
98
|
});
|
|
107
|
-
|
|
108
99
|
actions = require('connection/passwordless/actions');
|
|
109
|
-
|
|
110
100
|
require('core/index').connections.mockImplementation(function () {
|
|
111
|
-
return
|
|
101
|
+
return _immutable.default.fromJS([]);
|
|
112
102
|
});
|
|
113
103
|
});
|
|
114
104
|
describe('requestPasswordlessEmail()', function () {
|
|
@@ -123,31 +113,24 @@ describe('passwordless actions', function () {
|
|
|
123
113
|
});
|
|
124
114
|
it('calls startPasswordless with a custom email connection name', function () {
|
|
125
115
|
actions.requestPasswordlessEmail('id');
|
|
126
|
-
|
|
127
116
|
require('core/index').connections.mockImplementation(function () {
|
|
128
|
-
return
|
|
117
|
+
return _immutable.default.fromJS([{
|
|
129
118
|
name: 'custom-connection',
|
|
130
119
|
strategy: 'email',
|
|
131
120
|
type: 'passwordless'
|
|
132
121
|
}]);
|
|
133
122
|
});
|
|
134
|
-
|
|
135
123
|
require('core/index').useCustomPasswordlessConnection.mockReturnValue(true);
|
|
136
|
-
|
|
137
124
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
138
125
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').startPasswordless, 1);
|
|
139
126
|
});
|
|
140
127
|
it('calls setPasswordlessStarted() on success', function () {
|
|
141
128
|
actions.requestPasswordlessEmail('id');
|
|
142
129
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
143
|
-
|
|
144
130
|
require('core/web_api').startPasswordless.mock.calls[0][2](null);
|
|
145
|
-
|
|
146
131
|
var _require = require('store/index'),
|
|
147
|
-
|
|
148
|
-
|
|
132
|
+
swap = _require.swap;
|
|
149
133
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
150
|
-
|
|
151
134
|
swap.mock.calls[0][3]('model');
|
|
152
135
|
(0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
|
|
153
136
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setPasswordlessStarted, 1);
|
|
@@ -159,13 +142,10 @@ describe('passwordless actions', function () {
|
|
|
159
142
|
var error = new Error('foobar');
|
|
160
143
|
error.error = 'some_error_code';
|
|
161
144
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
162
|
-
|
|
163
145
|
jest.runAllTimers();
|
|
164
|
-
|
|
165
146
|
var _require2 = require('store/index'),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
147
|
+
read = _require2.read,
|
|
148
|
+
swap = _require2.swap;
|
|
169
149
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
170
150
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
171
151
|
});
|
|
@@ -176,13 +156,10 @@ describe('passwordless actions', function () {
|
|
|
176
156
|
error.error = 'sms_provider_error';
|
|
177
157
|
error.description = 'something (Code: 21211)';
|
|
178
158
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
179
|
-
|
|
180
159
|
jest.runAllTimers();
|
|
181
|
-
|
|
182
160
|
var _require3 = require('store/index'),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
161
|
+
read = _require3.read,
|
|
162
|
+
swap = _require3.swap;
|
|
186
163
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
187
164
|
});
|
|
188
165
|
});
|
|
@@ -190,29 +167,22 @@ describe('passwordless actions', function () {
|
|
|
190
167
|
describe('resendEmail()', function () {
|
|
191
168
|
it('calls setResendSuccess() on success', function () {
|
|
192
169
|
actions.resendEmail('id');
|
|
193
|
-
|
|
194
170
|
var _require4 = require('store/index'),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
171
|
+
read = _require4.read,
|
|
172
|
+
swap = _require4.swap;
|
|
198
173
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
199
174
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
200
|
-
|
|
201
175
|
require('core/web_api').startPasswordless.mock.calls[0][2](null);
|
|
202
|
-
|
|
203
176
|
swap.mock.calls[1][3]('model');
|
|
204
177
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setResendSuccess, 1);
|
|
205
178
|
});
|
|
206
179
|
it('calls setResendFailed on error', function () {
|
|
207
180
|
actions.resendEmail('id');
|
|
208
|
-
|
|
209
181
|
var _require5 = require('store/index'),
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
182
|
+
read = _require5.read,
|
|
183
|
+
swap = _require5.swap;
|
|
213
184
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
214
185
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
215
|
-
|
|
216
186
|
require('core/web_api').startPasswordless.mock.calls[0][2](new Error('foobar'));
|
|
217
187
|
jest.runAllTimers();
|
|
218
188
|
swap.mock.calls[1][3]('model');
|
|
@@ -231,31 +201,24 @@ describe('passwordless actions', function () {
|
|
|
231
201
|
});
|
|
232
202
|
it('calls startPasswordless with a custom SMS connection', function () {
|
|
233
203
|
actions.sendSMS('id');
|
|
234
|
-
|
|
235
204
|
require('core/index').connections.mockImplementation(function () {
|
|
236
|
-
return
|
|
205
|
+
return _immutable.default.fromJS([{
|
|
237
206
|
name: 'custom-connection',
|
|
238
207
|
strategy: 'sms',
|
|
239
208
|
type: 'passwordless'
|
|
240
209
|
}]);
|
|
241
210
|
});
|
|
242
|
-
|
|
243
211
|
require('core/index').useCustomPasswordlessConnection.mockReturnValue(true);
|
|
244
212
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
245
|
-
|
|
246
213
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').startPasswordless, 1);
|
|
247
214
|
});
|
|
248
215
|
it('calls setPasswordlessStarted() on success', function () {
|
|
249
216
|
actions.sendSMS('id');
|
|
250
217
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
251
|
-
|
|
252
218
|
require('core/web_api').startPasswordless.mock.calls[0][2](null);
|
|
253
|
-
|
|
254
219
|
var _require6 = require('store/index'),
|
|
255
|
-
|
|
256
|
-
|
|
220
|
+
swap = _require6.swap;
|
|
257
221
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
258
|
-
|
|
259
222
|
swap.mock.calls[0][3]('model');
|
|
260
223
|
(0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
|
|
261
224
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setPasswordlessStarted, 1);
|
|
@@ -267,13 +230,10 @@ describe('passwordless actions', function () {
|
|
|
267
230
|
var error = new Error('foobar');
|
|
268
231
|
error.error = 'some_error_code';
|
|
269
232
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
270
|
-
|
|
271
233
|
jest.runAllTimers();
|
|
272
|
-
|
|
273
234
|
var _require7 = require('store/index'),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
235
|
+
read = _require7.read,
|
|
236
|
+
swap = _require7.swap;
|
|
277
237
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
278
238
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
279
239
|
});
|
|
@@ -284,13 +244,10 @@ describe('passwordless actions', function () {
|
|
|
284
244
|
error.error = 'sms_provider_error';
|
|
285
245
|
error.description = 'something (Code: 21211)';
|
|
286
246
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
287
|
-
|
|
288
247
|
jest.runAllTimers();
|
|
289
|
-
|
|
290
248
|
var _require8 = require('store/index'),
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
249
|
+
read = _require8.read,
|
|
250
|
+
swap = _require8.swap;
|
|
294
251
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
295
252
|
});
|
|
296
253
|
it('emits the "authorization_error" event', function () {
|
|
@@ -299,9 +256,7 @@ describe('passwordless actions', function () {
|
|
|
299
256
|
var error = new Error('foobar');
|
|
300
257
|
error.error = 'some_error_code';
|
|
301
258
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
302
|
-
|
|
303
259
|
jest.runAllTimers();
|
|
304
|
-
|
|
305
260
|
(0, _testUtils.expectMockToMatch)(require('core/index').emitAuthorizationErrorEvent, 1);
|
|
306
261
|
});
|
|
307
262
|
});
|
|
@@ -309,20 +264,16 @@ describe('passwordless actions', function () {
|
|
|
309
264
|
describe('login()', function () {
|
|
310
265
|
it('sets setSubmitting to true', function () {
|
|
311
266
|
actions.logIn('id');
|
|
312
|
-
|
|
313
267
|
var _require9 = require('store/index'),
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
268
|
+
read = _require9.read,
|
|
269
|
+
swap = _require9.swap;
|
|
317
270
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
318
271
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
319
272
|
});
|
|
320
|
-
|
|
321
273
|
it('calls webApi.passwordlessVerify() with sms options', function () {
|
|
322
274
|
actions.logIn('id');
|
|
323
275
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').passwordlessVerify, 1);
|
|
324
276
|
});
|
|
325
|
-
|
|
326
277
|
it('calls webApi.passwordlessVerify() with email options', function () {
|
|
327
278
|
require('connection/passwordless/index').isEmail = function () {
|
|
328
279
|
return true;
|
|
@@ -330,37 +281,30 @@ describe('passwordless actions', function () {
|
|
|
330
281
|
actions.logIn('id');
|
|
331
282
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').passwordlessVerify, 1);
|
|
332
283
|
});
|
|
333
|
-
|
|
334
284
|
describe('on webApi.passwordlessVerify() callback', function () {
|
|
335
285
|
describe('when there is an error', function () {
|
|
336
286
|
it('formats the error', function () {
|
|
337
287
|
actions.logIn('id');
|
|
338
|
-
|
|
339
288
|
var error = new Error('foobar');
|
|
340
289
|
error.error = 'some_error_code';
|
|
341
290
|
require('core/web_api').passwordlessVerify.mock.calls[0][2](error);
|
|
342
|
-
|
|
343
291
|
var _require10 = require('store/index'),
|
|
344
|
-
|
|
345
|
-
|
|
292
|
+
swap = _require10.swap;
|
|
346
293
|
(0, _testUtils.expectMockToMatch)(swap, 2);
|
|
347
294
|
});
|
|
348
|
-
|
|
349
295
|
it('emits the "authorization_error" event', function () {
|
|
350
296
|
actions.logIn('id');
|
|
351
|
-
|
|
352
297
|
var error = new Error('foobar');
|
|
353
298
|
error.error = 'some_error_code';
|
|
354
299
|
require('core/web_api').passwordlessVerify.mock.calls[0][2](error);
|
|
355
|
-
|
|
356
300
|
(0, _testUtils.expectMockToMatch)(require('core/index').emitAuthorizationErrorEvent, 1);
|
|
357
301
|
});
|
|
358
302
|
});
|
|
359
|
-
|
|
360
303
|
it('calls logInSuccess on success', function () {
|
|
361
304
|
actions.logIn('id');
|
|
362
|
-
require('core/web_api').passwordlessVerify.mock.calls[0][2](null, {
|
|
363
|
-
|
|
305
|
+
require('core/web_api').passwordlessVerify.mock.calls[0][2](null, {
|
|
306
|
+
result: true
|
|
307
|
+
});
|
|
364
308
|
(0, _testUtils.expectMockToMatch)(require('core/actions').logInSuccess, 1);
|
|
365
309
|
});
|
|
366
310
|
});
|
|
@@ -368,23 +312,17 @@ describe('passwordless actions', function () {
|
|
|
368
312
|
describe('toggleTermsAcceptance()', function () {
|
|
369
313
|
it('calls internalToggleTermsAcceptance()', function () {
|
|
370
314
|
actions.toggleTermsAcceptance('id');
|
|
371
|
-
|
|
372
315
|
var _require11 = require('store/index'),
|
|
373
|
-
|
|
374
|
-
|
|
316
|
+
swap = _require11.swap;
|
|
375
317
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
376
|
-
|
|
377
318
|
swap.mock.calls[0][3]('model');
|
|
378
|
-
|
|
379
319
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').toggleTermsAcceptance, 1);
|
|
380
320
|
});
|
|
381
321
|
});
|
|
382
322
|
it('restart calls restartPasswordless', function () {
|
|
383
323
|
actions.restart('id');
|
|
384
|
-
|
|
385
324
|
var _require12 = require('store/index'),
|
|
386
|
-
|
|
387
|
-
|
|
325
|
+
swap = _require12.swap;
|
|
388
326
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
389
327
|
});
|
|
390
328
|
});
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _actions = require(
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var l = _interopRequireWildcard(_index);
|
|
10
|
-
|
|
11
|
-
var _index2 = require('store/index');
|
|
12
|
-
|
|
13
|
-
var _web_api = require('../../core/web_api');
|
|
14
|
-
|
|
15
|
-
var _web_api2 = _interopRequireDefault(_web_api);
|
|
16
|
-
|
|
17
|
-
var _immutable = require('immutable');
|
|
18
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _actions = require("../../core/actions");
|
|
4
|
+
var _testUtils = require("testUtils");
|
|
5
|
+
var l = _interopRequireWildcard(require("core/index"));
|
|
6
|
+
var _index2 = require("store/index");
|
|
7
|
+
var _web_api = _interopRequireDefault(require("../../core/web_api"));
|
|
8
|
+
var _immutable = require("immutable");
|
|
19
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
|
|
21
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; }
|
|
22
|
-
|
|
10
|
+
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); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
16
|
jest.mock('../../core/web_api', function () {
|
|
24
17
|
return {
|
|
25
18
|
__esModule: true,
|
|
@@ -29,86 +22,70 @@ jest.mock('../../core/web_api', function () {
|
|
|
29
22
|
}
|
|
30
23
|
};
|
|
31
24
|
});
|
|
32
|
-
|
|
33
25
|
jest.mock('store/index', function () {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return _ref = {
|
|
26
|
+
return _defineProperty({
|
|
37
27
|
read: jest.fn(function () {
|
|
38
28
|
return 'model';
|
|
39
29
|
}),
|
|
40
30
|
getEntity: 'getEntity',
|
|
41
31
|
swap: jest.fn(),
|
|
42
32
|
updateEntity: 'updateEntity'
|
|
43
|
-
},
|
|
33
|
+
}, "read", jest.fn());
|
|
44
34
|
});
|
|
45
|
-
|
|
46
35
|
jest.mock('core/index');
|
|
47
|
-
|
|
48
36
|
describe('core.actions', function () {
|
|
49
37
|
beforeEach(function () {
|
|
50
38
|
jest.resetAllMocks();
|
|
51
|
-
|
|
52
39
|
l.submitting.mockReturnValue(true);
|
|
53
40
|
l.id.mockReturnValue('id');
|
|
54
41
|
l.auth.params.mockReturnValue((0, _immutable.fromJS)({}));
|
|
55
42
|
});
|
|
56
|
-
|
|
57
43
|
describe('checkSession', function () {
|
|
58
44
|
it('should set submitting on start', function () {
|
|
59
45
|
(0, _actions.checkSession)('id', 'params', 'cb');
|
|
60
|
-
|
|
61
46
|
var _require = require('store/index'),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
read = _require.read,
|
|
48
|
+
swap = _require.swap;
|
|
65
49
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
66
50
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
67
51
|
swap.mock.calls[0][3]('model');
|
|
68
52
|
(0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
|
|
69
53
|
});
|
|
70
54
|
});
|
|
71
|
-
|
|
72
55
|
describe('logIn', function () {
|
|
73
56
|
it('run the loggingIn hook', function (done) {
|
|
74
57
|
var m = {};
|
|
75
58
|
_index2.read.mockReturnValue(m);
|
|
76
|
-
|
|
77
|
-
_web_api2.default.logIn.mockImplementation(function (id, params, authParams, cb) {
|
|
59
|
+
_web_api.default.logIn.mockImplementation(function (id, params, authParams, cb) {
|
|
78
60
|
cb(null, {});
|
|
79
61
|
done();
|
|
80
62
|
});
|
|
81
|
-
|
|
82
63
|
l.runHook.mockImplementation(function (m, hook, context, fn) {
|
|
83
64
|
expect(hook).toEqual('loggingIn');
|
|
84
65
|
fn();
|
|
85
66
|
});
|
|
86
|
-
|
|
87
67
|
(0, _actions.logIn)();
|
|
88
68
|
});
|
|
89
|
-
|
|
90
69
|
it('should display an error if one was thrown from the hook', function (done) {
|
|
91
70
|
var m = {};
|
|
92
71
|
_index2.read.mockReturnValue(m);
|
|
93
|
-
|
|
94
72
|
var store = require('store/index');
|
|
95
|
-
|
|
96
73
|
store.swap.mockImplementation(function (entity, n, id, fn, value, error) {
|
|
97
74
|
if (error) {
|
|
98
75
|
expect(error).toEqual('This is a hook error');
|
|
99
76
|
done();
|
|
100
77
|
}
|
|
101
78
|
});
|
|
102
|
-
|
|
103
79
|
l.loginErrorMessage.mockImplementation(function (m, error) {
|
|
104
80
|
return error.description;
|
|
105
81
|
});
|
|
106
|
-
|
|
107
82
|
l.runHook.mockImplementation(function (m, hook, fn) {
|
|
108
83
|
expect(hook).toEqual('loggingIn');
|
|
109
|
-
throw {
|
|
84
|
+
throw {
|
|
85
|
+
code: 'hook_error',
|
|
86
|
+
description: 'This is a hook error'
|
|
87
|
+
};
|
|
110
88
|
});
|
|
111
|
-
|
|
112
89
|
(0, _actions.logIn)();
|
|
113
90
|
});
|
|
114
91
|
});
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _immutable = require('immutable');
|
|
4
|
-
|
|
5
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
6
|
-
|
|
7
|
-
var _client = require('../../../core/client');
|
|
1
|
+
"use strict";
|
|
8
2
|
|
|
3
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
4
|
+
var _client = require("../../../core/client");
|
|
9
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
6
|
describe('core/client/index', function () {
|
|
12
7
|
describe('initClient', function () {
|
|
13
8
|
['none', 'low', 'fair', 'good', 'excellent'].forEach(function (policy) {
|
|
14
|
-
it(
|
|
9
|
+
it("loads password policy '".concat(policy, "' correctly without a password_complexity_options option"), function () {
|
|
15
10
|
var client = {
|
|
16
11
|
strategies: [{
|
|
17
12
|
name: 'auth0',
|
|
@@ -21,21 +16,23 @@ describe('core/client/index', function () {
|
|
|
21
16
|
}]
|
|
22
17
|
}]
|
|
23
18
|
};
|
|
24
|
-
var result = (0, _client.initClient)(
|
|
19
|
+
var result = (0, _client.initClient)(_immutable.default.fromJS({}), client).toJS();
|
|
25
20
|
expect(result.client.connections.database[0].passwordPolicy.length).toMatchSnapshot();
|
|
26
21
|
});
|
|
27
|
-
it(
|
|
22
|
+
it("loads password policy '".concat(policy, "' correctly with a password_complexity_options option"), function () {
|
|
28
23
|
var client = {
|
|
29
24
|
strategies: [{
|
|
30
25
|
name: 'auth0',
|
|
31
26
|
connections: [{
|
|
32
27
|
name: 'Username-Password-Authentication',
|
|
33
28
|
passwordPolicy: policy,
|
|
34
|
-
password_complexity_options: {
|
|
29
|
+
password_complexity_options: {
|
|
30
|
+
min_length: 4
|
|
31
|
+
}
|
|
35
32
|
}]
|
|
36
33
|
}]
|
|
37
34
|
};
|
|
38
|
-
var result = (0, _client.initClient)(
|
|
35
|
+
var result = (0, _client.initClient)(_immutable.default.fromJS({}), client).toJS();
|
|
39
36
|
expect(result.client.connections.database[0].passwordPolicy.length).toMatchSnapshot();
|
|
40
37
|
});
|
|
41
38
|
});
|