auth0-lock 11.35.0 → 12.0.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 +3 -1
- package/.shiprc +4 -5
- package/CHANGELOG.md +25 -0
- package/DEVELOPMENT.md +1 -1
- package/README.md +20 -16
- 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 +24 -47
- package/lib/__tests__/connection/database/password_reset_confirmation.js +23 -32
- package/lib/__tests__/connection/database/reset_password.js +17 -39
- package/lib/__tests__/connection/database/signed_up_confirmation.js +23 -32
- 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 +32 -75
- package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +23 -32
- 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 +23 -32
- 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/social_or_email_login_screen.js +7 -28
- package/lib/__tests__/engine/passwordless/social_or_phone_number_login_screen.js +7 -28
- 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 +23 -42
- 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 +15 -34
- 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 -65
- 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 +154 -305
- package/lib/core/loading_screen.js +61 -71
- package/lib/core/pane_separator.js +10 -10
- package/lib/core/remote_data.js +30 -51
- 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 +22 -28
- package/lib/core/web_api/p2_api.js +162 -171
- package/lib/core/web_api.js +106 -94
- 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 +80 -116
- package/lib/engine/passwordless/social_or_phone_number_login_screen.js +79 -110
- package/lib/engine/passwordless.js +75 -104
- package/lib/field/actions.js +11 -17
- package/lib/field/captcha/captcha_pane.js +83 -103
- 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 +50 -87
- 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/package.json +48 -34
- 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(),
|
|
@@ -65,9 +55,11 @@ describe('passwordless actions', function () {
|
|
|
65
55
|
};
|
|
66
56
|
});
|
|
67
57
|
jest.mock('i18n', function () {
|
|
68
|
-
return {
|
|
58
|
+
return {
|
|
59
|
+
html: function html(_, keys) {
|
|
69
60
|
return keys.join(',');
|
|
70
|
-
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
71
63
|
});
|
|
72
64
|
jest.mock('core/index', function () {
|
|
73
65
|
return {
|
|
@@ -106,11 +98,9 @@ describe('passwordless actions', function () {
|
|
|
106
98
|
updateEntity: 'updateEntity'
|
|
107
99
|
};
|
|
108
100
|
});
|
|
109
|
-
|
|
110
101
|
actions = require('connection/passwordless/actions');
|
|
111
|
-
|
|
112
102
|
require('core/index').connections.mockImplementation(function () {
|
|
113
|
-
return
|
|
103
|
+
return _immutable.default.fromJS([]);
|
|
114
104
|
});
|
|
115
105
|
});
|
|
116
106
|
describe('requestPasswordlessEmail()', function () {
|
|
@@ -125,31 +115,24 @@ describe('passwordless actions', function () {
|
|
|
125
115
|
});
|
|
126
116
|
it('calls startPasswordless with a custom email connection name', function () {
|
|
127
117
|
actions.requestPasswordlessEmail('id');
|
|
128
|
-
|
|
129
118
|
require('core/index').connections.mockImplementation(function () {
|
|
130
|
-
return
|
|
119
|
+
return _immutable.default.fromJS([{
|
|
131
120
|
name: 'custom-connection',
|
|
132
121
|
strategy: 'email',
|
|
133
122
|
type: 'passwordless'
|
|
134
123
|
}]);
|
|
135
124
|
});
|
|
136
|
-
|
|
137
125
|
require('core/index').useCustomPasswordlessConnection.mockReturnValue(true);
|
|
138
|
-
|
|
139
126
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
140
127
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').startPasswordless, 1);
|
|
141
128
|
});
|
|
142
129
|
it('calls setPasswordlessStarted() on success', function () {
|
|
143
130
|
actions.requestPasswordlessEmail('id');
|
|
144
131
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
145
|
-
|
|
146
132
|
require('core/web_api').startPasswordless.mock.calls[0][2](null);
|
|
147
|
-
|
|
148
133
|
var _require = require('store/index'),
|
|
149
|
-
|
|
150
|
-
|
|
134
|
+
swap = _require.swap;
|
|
151
135
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
152
|
-
|
|
153
136
|
swap.mock.calls[0][3]('model');
|
|
154
137
|
(0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
|
|
155
138
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setPasswordlessStarted, 1);
|
|
@@ -161,13 +144,10 @@ describe('passwordless actions', function () {
|
|
|
161
144
|
var error = new Error('foobar');
|
|
162
145
|
error.error = 'some_error_code';
|
|
163
146
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
164
|
-
|
|
165
147
|
jest.runAllTimers();
|
|
166
|
-
|
|
167
148
|
var _require2 = require('store/index'),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
149
|
+
read = _require2.read,
|
|
150
|
+
swap = _require2.swap;
|
|
171
151
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
172
152
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
173
153
|
});
|
|
@@ -178,13 +158,10 @@ describe('passwordless actions', function () {
|
|
|
178
158
|
error.error = 'sms_provider_error';
|
|
179
159
|
error.description = 'something (Code: 21211)';
|
|
180
160
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
181
|
-
|
|
182
161
|
jest.runAllTimers();
|
|
183
|
-
|
|
184
162
|
var _require3 = require('store/index'),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
163
|
+
read = _require3.read,
|
|
164
|
+
swap = _require3.swap;
|
|
188
165
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
189
166
|
});
|
|
190
167
|
});
|
|
@@ -192,29 +169,22 @@ describe('passwordless actions', function () {
|
|
|
192
169
|
describe('resendEmail()', function () {
|
|
193
170
|
it('calls setResendSuccess() on success', function () {
|
|
194
171
|
actions.resendEmail('id');
|
|
195
|
-
|
|
196
172
|
var _require4 = require('store/index'),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
173
|
+
read = _require4.read,
|
|
174
|
+
swap = _require4.swap;
|
|
200
175
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
201
176
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
202
|
-
|
|
203
177
|
require('core/web_api').startPasswordless.mock.calls[0][2](null);
|
|
204
|
-
|
|
205
178
|
swap.mock.calls[1][3]('model');
|
|
206
179
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setResendSuccess, 1);
|
|
207
180
|
});
|
|
208
181
|
it('calls setResendFailed on error', function () {
|
|
209
182
|
actions.resendEmail('id');
|
|
210
|
-
|
|
211
183
|
var _require5 = require('store/index'),
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
184
|
+
read = _require5.read,
|
|
185
|
+
swap = _require5.swap;
|
|
215
186
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
216
187
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
217
|
-
|
|
218
188
|
require('core/web_api').startPasswordless.mock.calls[0][2](new Error('foobar'));
|
|
219
189
|
jest.runAllTimers();
|
|
220
190
|
swap.mock.calls[1][3]('model');
|
|
@@ -233,31 +203,24 @@ describe('passwordless actions', function () {
|
|
|
233
203
|
});
|
|
234
204
|
it('calls startPasswordless with a custom SMS connection', function () {
|
|
235
205
|
actions.sendSMS('id');
|
|
236
|
-
|
|
237
206
|
require('core/index').connections.mockImplementation(function () {
|
|
238
|
-
return
|
|
207
|
+
return _immutable.default.fromJS([{
|
|
239
208
|
name: 'custom-connection',
|
|
240
209
|
strategy: 'sms',
|
|
241
210
|
type: 'passwordless'
|
|
242
211
|
}]);
|
|
243
212
|
});
|
|
244
|
-
|
|
245
213
|
require('core/index').useCustomPasswordlessConnection.mockReturnValue(true);
|
|
246
214
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
247
|
-
|
|
248
215
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').startPasswordless, 1);
|
|
249
216
|
});
|
|
250
217
|
it('calls setPasswordlessStarted() on success', function () {
|
|
251
218
|
actions.sendSMS('id');
|
|
252
219
|
require('core/actions').validateAndSubmit.mock.calls[0][2]('model');
|
|
253
|
-
|
|
254
220
|
require('core/web_api').startPasswordless.mock.calls[0][2](null);
|
|
255
|
-
|
|
256
221
|
var _require6 = require('store/index'),
|
|
257
|
-
|
|
258
|
-
|
|
222
|
+
swap = _require6.swap;
|
|
259
223
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
260
|
-
|
|
261
224
|
swap.mock.calls[0][3]('model');
|
|
262
225
|
(0, _testUtils.expectMockToMatch)(require('core/index').setSubmitting, 1);
|
|
263
226
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').setPasswordlessStarted, 1);
|
|
@@ -269,13 +232,10 @@ describe('passwordless actions', function () {
|
|
|
269
232
|
var error = new Error('foobar');
|
|
270
233
|
error.error = 'some_error_code';
|
|
271
234
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
272
|
-
|
|
273
235
|
jest.runAllTimers();
|
|
274
|
-
|
|
275
236
|
var _require7 = require('store/index'),
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
237
|
+
read = _require7.read,
|
|
238
|
+
swap = _require7.swap;
|
|
279
239
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
280
240
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
281
241
|
});
|
|
@@ -286,13 +246,10 @@ describe('passwordless actions', function () {
|
|
|
286
246
|
error.error = 'sms_provider_error';
|
|
287
247
|
error.description = 'something (Code: 21211)';
|
|
288
248
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
289
|
-
|
|
290
249
|
jest.runAllTimers();
|
|
291
|
-
|
|
292
250
|
var _require8 = require('store/index'),
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
251
|
+
read = _require8.read,
|
|
252
|
+
swap = _require8.swap;
|
|
296
253
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
297
254
|
});
|
|
298
255
|
it('emits the "authorization_error" event', function () {
|
|
@@ -301,9 +258,7 @@ describe('passwordless actions', function () {
|
|
|
301
258
|
var error = new Error('foobar');
|
|
302
259
|
error.error = 'some_error_code';
|
|
303
260
|
require('core/web_api').startPasswordless.mock.calls[0][2](error);
|
|
304
|
-
|
|
305
261
|
jest.runAllTimers();
|
|
306
|
-
|
|
307
262
|
(0, _testUtils.expectMockToMatch)(require('core/index').emitAuthorizationErrorEvent, 1);
|
|
308
263
|
});
|
|
309
264
|
});
|
|
@@ -311,20 +266,16 @@ describe('passwordless actions', function () {
|
|
|
311
266
|
describe('login()', function () {
|
|
312
267
|
it('sets setSubmitting to true', function () {
|
|
313
268
|
actions.logIn('id');
|
|
314
|
-
|
|
315
269
|
var _require9 = require('store/index'),
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
270
|
+
read = _require9.read,
|
|
271
|
+
swap = _require9.swap;
|
|
319
272
|
(0, _testUtils.expectMockToMatch)(read, 1);
|
|
320
273
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
321
274
|
});
|
|
322
|
-
|
|
323
275
|
it('calls webApi.passwordlessVerify() with sms options', function () {
|
|
324
276
|
actions.logIn('id');
|
|
325
277
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').passwordlessVerify, 1);
|
|
326
278
|
});
|
|
327
|
-
|
|
328
279
|
it('calls webApi.passwordlessVerify() with email options', function () {
|
|
329
280
|
require('connection/passwordless/index').isEmail = function () {
|
|
330
281
|
return true;
|
|
@@ -332,37 +283,30 @@ describe('passwordless actions', function () {
|
|
|
332
283
|
actions.logIn('id');
|
|
333
284
|
(0, _testUtils.expectMockToMatch)(require('core/web_api').passwordlessVerify, 1);
|
|
334
285
|
});
|
|
335
|
-
|
|
336
286
|
describe('on webApi.passwordlessVerify() callback', function () {
|
|
337
287
|
describe('when there is an error', function () {
|
|
338
288
|
it('formats the error', function () {
|
|
339
289
|
actions.logIn('id');
|
|
340
|
-
|
|
341
290
|
var error = new Error('foobar');
|
|
342
291
|
error.error = 'some_error_code';
|
|
343
292
|
require('core/web_api').passwordlessVerify.mock.calls[0][2](error);
|
|
344
|
-
|
|
345
293
|
var _require10 = require('store/index'),
|
|
346
|
-
|
|
347
|
-
|
|
294
|
+
swap = _require10.swap;
|
|
348
295
|
(0, _testUtils.expectMockToMatch)(swap, 2);
|
|
349
296
|
});
|
|
350
|
-
|
|
351
297
|
it('emits the "authorization_error" event', function () {
|
|
352
298
|
actions.logIn('id');
|
|
353
|
-
|
|
354
299
|
var error = new Error('foobar');
|
|
355
300
|
error.error = 'some_error_code';
|
|
356
301
|
require('core/web_api').passwordlessVerify.mock.calls[0][2](error);
|
|
357
|
-
|
|
358
302
|
(0, _testUtils.expectMockToMatch)(require('core/index').emitAuthorizationErrorEvent, 1);
|
|
359
303
|
});
|
|
360
304
|
});
|
|
361
|
-
|
|
362
305
|
it('calls logInSuccess on success', function () {
|
|
363
306
|
actions.logIn('id');
|
|
364
|
-
require('core/web_api').passwordlessVerify.mock.calls[0][2](null, {
|
|
365
|
-
|
|
307
|
+
require('core/web_api').passwordlessVerify.mock.calls[0][2](null, {
|
|
308
|
+
result: true
|
|
309
|
+
});
|
|
366
310
|
(0, _testUtils.expectMockToMatch)(require('core/actions').logInSuccess, 1);
|
|
367
311
|
});
|
|
368
312
|
});
|
|
@@ -370,23 +314,17 @@ describe('passwordless actions', function () {
|
|
|
370
314
|
describe('toggleTermsAcceptance()', function () {
|
|
371
315
|
it('calls internalToggleTermsAcceptance()', function () {
|
|
372
316
|
actions.toggleTermsAcceptance('id');
|
|
373
|
-
|
|
374
317
|
var _require11 = require('store/index'),
|
|
375
|
-
|
|
376
|
-
|
|
318
|
+
swap = _require11.swap;
|
|
377
319
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
378
|
-
|
|
379
320
|
swap.mock.calls[0][3]('model');
|
|
380
|
-
|
|
381
321
|
(0, _testUtils.expectMockToMatch)(require('connection/passwordless/index').toggleTermsAcceptance, 1);
|
|
382
322
|
});
|
|
383
323
|
});
|
|
384
324
|
it('restart calls restartPasswordless', function () {
|
|
385
325
|
actions.restart('id');
|
|
386
|
-
|
|
387
326
|
var _require12 = require('store/index'),
|
|
388
|
-
|
|
389
|
-
|
|
327
|
+
swap = _require12.swap;
|
|
390
328
|
(0, _testUtils.expectMockToMatch)(swap, 1);
|
|
391
329
|
});
|
|
392
330
|
});
|
|
@@ -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
|
});
|