auth0-lock 11.34.2 → 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 +26 -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,37 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
4
|
-
|
|
5
|
-
var _web_api = require('../../core/web_api');
|
|
6
|
-
|
|
7
|
-
var _web_api2 = _interopRequireDefault(_web_api);
|
|
1
|
+
"use strict";
|
|
8
2
|
|
|
3
|
+
var _web_api = _interopRequireDefault(require("../../core/web_api"));
|
|
9
4
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
5
|
+
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); }
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
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); }
|
|
11
11
|
describe('Auth0WebApi', function () {
|
|
12
|
-
var originalWindow
|
|
13
|
-
|
|
12
|
+
var originalWindow;
|
|
14
13
|
var LOCK_ID = 'lock-id';
|
|
15
14
|
var CLIENT_ID = 'client-id';
|
|
16
15
|
var DEFAULT_DOMAIN = 'test.com';
|
|
17
16
|
var client = function client() {
|
|
18
|
-
return
|
|
17
|
+
return _web_api.default.clients[LOCK_ID];
|
|
19
18
|
};
|
|
20
|
-
|
|
21
19
|
beforeEach(function () {
|
|
22
20
|
originalWindow = window.window;
|
|
23
21
|
});
|
|
24
|
-
|
|
25
22
|
afterEach(function () {
|
|
26
23
|
window.window = originalWindow;
|
|
27
24
|
});
|
|
28
|
-
|
|
29
25
|
describe('setupClient', function () {
|
|
30
26
|
it('sets the correct options when is on the hosted login page', function () {
|
|
31
27
|
delete window.location;
|
|
32
|
-
window.location =
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
|
|
29
|
+
host: DEFAULT_DOMAIN,
|
|
30
|
+
search: ''
|
|
31
|
+
});
|
|
32
|
+
_web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {
|
|
33
|
+
redirect: true
|
|
34
|
+
});
|
|
35
35
|
expect(client()).toEqual(expect.objectContaining({
|
|
36
36
|
isUniversalLogin: true,
|
|
37
37
|
domain: DEFAULT_DOMAIN,
|
|
@@ -40,39 +40,43 @@ describe('Auth0WebApi', function () {
|
|
|
40
40
|
}
|
|
41
41
|
}));
|
|
42
42
|
});
|
|
43
|
-
|
|
44
43
|
it('sets redirect: true when on the same origin as the specified domain', function () {
|
|
45
44
|
delete window.location;
|
|
46
|
-
window.location =
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
|
|
46
|
+
host: DEFAULT_DOMAIN,
|
|
47
|
+
search: ''
|
|
48
|
+
});
|
|
49
|
+
_web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
|
|
49
50
|
expect(client().authOpt.popup).toBe(false);
|
|
50
51
|
});
|
|
51
|
-
|
|
52
52
|
it('sets redirect: false when on a different origin as the specified domain', function () {
|
|
53
53
|
delete window.location;
|
|
54
|
-
window.location =
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
|
|
55
|
+
host: 'test-other.com',
|
|
56
|
+
search: ''
|
|
57
|
+
});
|
|
58
|
+
_web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
|
|
57
59
|
expect(client().authOpt.popup).toBe(true);
|
|
58
60
|
});
|
|
59
|
-
|
|
60
61
|
it('forces popup and sso mode for cordova, only when not running in the hosted environment', function () {
|
|
61
62
|
delete window.location;
|
|
62
|
-
window.location =
|
|
63
|
+
window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
|
|
64
|
+
host: DEFAULT_DOMAIN,
|
|
65
|
+
search: ''
|
|
66
|
+
});
|
|
63
67
|
window.cordova = true;
|
|
64
|
-
|
|
65
|
-
_web_api2.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
|
|
68
|
+
_web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
|
|
66
69
|
expect(client().authOpt.popup).toBe(false);
|
|
67
70
|
expect(client().authOpt.sso).toBeUndefined();
|
|
68
71
|
});
|
|
69
|
-
|
|
70
72
|
it('forces popup and sso mode for electron, only when not running in the hosted environment', function () {
|
|
71
73
|
delete window.location;
|
|
72
|
-
window.location =
|
|
74
|
+
window.location = _objectSpread(_objectSpread({}, originalWindow.location), {}, {
|
|
75
|
+
host: DEFAULT_DOMAIN,
|
|
76
|
+
search: ''
|
|
77
|
+
});
|
|
73
78
|
window.electron = true;
|
|
74
|
-
|
|
75
|
-
_web_api2.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
|
|
79
|
+
_web_api.default.setupClient(LOCK_ID, CLIENT_ID, DEFAULT_DOMAIN, {});
|
|
76
80
|
expect(client().authOpt.popup).toBe(false);
|
|
77
81
|
expect(client().authOpt.sso).toBeUndefined();
|
|
78
82
|
});
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
8
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _testUtils = require("testUtils");
|
|
9
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
6
|
jest.mock('core/pane_separator', function () {
|
|
12
7
|
return (0, _testUtils.mockComponent)('pane_separator');
|
|
13
8
|
});
|
|
@@ -23,17 +18,14 @@ jest.mock('connection/database/login_sign_up_tabs', function () {
|
|
|
23
18
|
jest.mock('connection/enterprise/single_sign_on_notice', function () {
|
|
24
19
|
return (0, _testUtils.mockComponent)('single_sign_on_notice');
|
|
25
20
|
});
|
|
26
|
-
|
|
27
21
|
var getComponent = function getComponent() {
|
|
28
22
|
var LoginScreen = require('engine/classic/login').default;
|
|
29
23
|
var screen = new LoginScreen();
|
|
30
24
|
return screen.render();
|
|
31
25
|
};
|
|
32
|
-
|
|
33
26
|
describe('LoginScreen', function () {
|
|
34
27
|
beforeEach(function () {
|
|
35
28
|
jest.resetModules();
|
|
36
|
-
|
|
37
29
|
jest.mock('connection/database/index', function () {
|
|
38
30
|
return {
|
|
39
31
|
databaseConnection: function databaseConnection() {
|
|
@@ -59,11 +51,11 @@ describe('LoginScreen', function () {
|
|
|
59
51
|
}
|
|
60
52
|
};
|
|
61
53
|
});
|
|
62
|
-
|
|
63
54
|
jest.mock('connection/database/actions', function () {
|
|
64
|
-
return {
|
|
55
|
+
return {
|
|
56
|
+
logIn: jest.fn()
|
|
57
|
+
};
|
|
65
58
|
});
|
|
66
|
-
|
|
67
59
|
jest.mock('connection/enterprise', function () {
|
|
68
60
|
return {
|
|
69
61
|
defaultEnterpriseConnection: function defaultEnterpriseConnection() {
|
|
@@ -77,20 +69,17 @@ describe('LoginScreen', function () {
|
|
|
77
69
|
}
|
|
78
70
|
};
|
|
79
71
|
});
|
|
80
|
-
|
|
81
72
|
jest.mock('connection/enterprise/actions', function () {
|
|
82
73
|
return {
|
|
83
74
|
logIn: jest.fn(),
|
|
84
75
|
startHRD: jest.fn()
|
|
85
76
|
};
|
|
86
77
|
});
|
|
87
|
-
|
|
88
78
|
jest.mock('core/signed_in_confirmation', function () {
|
|
89
79
|
return {
|
|
90
80
|
renderSignedInConfirmation: jest.fn()
|
|
91
81
|
};
|
|
92
82
|
});
|
|
93
|
-
|
|
94
83
|
jest.mock('engine/classic', function () {
|
|
95
84
|
return {
|
|
96
85
|
hasOnlyClassicConnections: function hasOnlyClassicConnections() {
|
|
@@ -101,13 +90,13 @@ describe('LoginScreen', function () {
|
|
|
101
90
|
}
|
|
102
91
|
};
|
|
103
92
|
});
|
|
104
|
-
|
|
105
93
|
jest.mock('i18n', function () {
|
|
106
|
-
return {
|
|
94
|
+
return {
|
|
95
|
+
str: function str(_, keys) {
|
|
107
96
|
return keys.join(',');
|
|
108
|
-
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
109
99
|
});
|
|
110
|
-
|
|
111
100
|
jest.mock('core/index', function () {
|
|
112
101
|
return {
|
|
113
102
|
hasSomeConnections: function hasSomeConnections() {
|
|
@@ -122,17 +111,15 @@ describe('LoginScreen', function () {
|
|
|
122
111
|
var defaultProps = {
|
|
123
112
|
i18n: {
|
|
124
113
|
str: function str() {
|
|
125
|
-
for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
|
|
114
|
+
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
126
115
|
keys[_key] = arguments[_key];
|
|
127
116
|
}
|
|
128
|
-
|
|
129
117
|
return keys.join(',');
|
|
130
118
|
},
|
|
131
119
|
html: function html() {
|
|
132
|
-
for (var _len2 = arguments.length, keys = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
120
|
+
for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
133
121
|
keys[_key2] = arguments[_key2];
|
|
134
122
|
}
|
|
135
|
-
|
|
136
123
|
return keys.join(',');
|
|
137
124
|
}
|
|
138
125
|
},
|
|
@@ -140,24 +127,21 @@ describe('LoginScreen', function () {
|
|
|
140
127
|
};
|
|
141
128
|
it('renders empty div by default', function () {
|
|
142
129
|
var Component = getComponent();
|
|
143
|
-
|
|
144
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
130
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
145
131
|
});
|
|
146
132
|
it('renders SocialButtonsPane when has social connections', function () {
|
|
147
133
|
require('core/index').hasSomeConnections = function (m, connection) {
|
|
148
134
|
return connection === 'social';
|
|
149
135
|
};
|
|
150
136
|
var Component = getComponent();
|
|
151
|
-
|
|
152
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
137
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
153
138
|
});
|
|
154
139
|
it('renders SingleSignOnNotice when SSO is enabled', function () {
|
|
155
140
|
require('engine/classic').isSSOEnabled = function () {
|
|
156
141
|
return true;
|
|
157
142
|
};
|
|
158
143
|
var Component = getComponent();
|
|
159
|
-
|
|
160
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
144
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
161
145
|
});
|
|
162
146
|
describe('renders LoginSignUpTabs', function () {
|
|
163
147
|
it('when database connection is enabled and has screen signUp', function () {
|
|
@@ -168,8 +152,7 @@ describe('LoginScreen', function () {
|
|
|
168
152
|
return screenName === 'signUp';
|
|
169
153
|
};
|
|
170
154
|
var Component = getComponent();
|
|
171
|
-
|
|
172
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
155
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
173
156
|
});
|
|
174
157
|
it('when social connection is enabled and has initial screen signUp and has screen signUp', function () {
|
|
175
158
|
require('core/index').hasSomeConnections = function (m, connection) {
|
|
@@ -179,8 +162,7 @@ describe('LoginScreen', function () {
|
|
|
179
162
|
return screenName === 'signUp';
|
|
180
163
|
};
|
|
181
164
|
var Component = getComponent();
|
|
182
|
-
|
|
183
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
165
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
184
166
|
});
|
|
185
167
|
});
|
|
186
168
|
describe('renders LoginPane', function () {
|
|
@@ -189,24 +171,21 @@ describe('LoginScreen', function () {
|
|
|
189
171
|
return true;
|
|
190
172
|
};
|
|
191
173
|
var Component = getComponent();
|
|
192
|
-
|
|
193
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
174
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
194
175
|
});
|
|
195
176
|
it('when has database connection', function () {
|
|
196
177
|
require('core/index').hasSomeConnections = function (m, connection) {
|
|
197
178
|
return connection === 'database';
|
|
198
179
|
};
|
|
199
180
|
var Component = getComponent();
|
|
200
|
-
|
|
201
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
181
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
202
182
|
});
|
|
203
183
|
it('when has enterprise connection', function () {
|
|
204
184
|
require('core/index').hasSomeConnections = function (m, connection) {
|
|
205
185
|
return connection === 'enterprise';
|
|
206
186
|
};
|
|
207
187
|
var Component = getComponent();
|
|
208
|
-
|
|
209
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
188
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
210
189
|
});
|
|
211
190
|
});
|
|
212
191
|
});
|
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _enzyme = require('enzyme');
|
|
8
|
-
|
|
9
|
-
var _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
10
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
11
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
7
|
jest.mock('connection/database/mfa_pane', function () {
|
|
14
8
|
return (0, _testUtils.mockComponent)('mfa_pane');
|
|
15
9
|
});
|
|
16
10
|
|
|
17
11
|
//there's a circular dependency with this module, so we need to mock it
|
|
18
12
|
jest.mock('engine/classic');
|
|
19
|
-
|
|
20
13
|
var getComponent = function getComponent() {
|
|
21
14
|
var MFALoginScreen = require('engine/classic/mfa_login_screen').default;
|
|
22
15
|
var screen = new MFALoginScreen();
|
|
23
16
|
return screen.render();
|
|
24
17
|
};
|
|
25
|
-
|
|
26
18
|
describe('MFALoginScreen', function () {
|
|
27
19
|
beforeEach(function () {
|
|
28
20
|
jest.resetModules();
|
|
29
|
-
|
|
30
21
|
jest.mock('connection/database/index', function () {
|
|
31
22
|
return {
|
|
32
23
|
hasScreen: function hasScreen() {
|
|
@@ -34,14 +25,12 @@ describe('MFALoginScreen', function () {
|
|
|
34
25
|
}
|
|
35
26
|
};
|
|
36
27
|
});
|
|
37
|
-
|
|
38
28
|
jest.mock('connection/database/actions', function () {
|
|
39
29
|
return {
|
|
40
30
|
cancelMFALogin: jest.fn(),
|
|
41
31
|
logIn: jest.fn()
|
|
42
32
|
};
|
|
43
33
|
});
|
|
44
|
-
|
|
45
34
|
jest.mock('core/signed_in_confirmation', function () {
|
|
46
35
|
return {
|
|
47
36
|
renderSignedInConfirmation: jest.fn()
|
|
@@ -51,10 +40,9 @@ describe('MFALoginScreen', function () {
|
|
|
51
40
|
var defaultProps = {
|
|
52
41
|
i18n: {
|
|
53
42
|
str: function str() {
|
|
54
|
-
for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
+
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
44
|
keys[_key] = arguments[_key];
|
|
56
45
|
}
|
|
57
|
-
|
|
58
46
|
return keys.join(',');
|
|
59
47
|
}
|
|
60
48
|
},
|
|
@@ -62,7 +50,6 @@ describe('MFALoginScreen', function () {
|
|
|
62
50
|
};
|
|
63
51
|
it('renders correctly', function () {
|
|
64
52
|
var Component = getComponent();
|
|
65
|
-
|
|
66
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
53
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
67
54
|
});
|
|
68
55
|
});
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
4
|
-
|
|
5
|
-
var _react = require('react');
|
|
6
|
-
|
|
7
|
-
var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
|
|
9
|
-
var _testUtils = require('testUtils');
|
|
10
|
-
|
|
11
|
-
var _testUtils2 = require('../../testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _testUtils = require("testUtils");
|
|
5
|
+
var _testUtils2 = require("../../testUtils");
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
8
|
jest.mock('field/email/email_pane', function () {
|
|
16
9
|
return (0, _testUtils.mockComponent)('email_pane');
|
|
17
10
|
});
|
|
@@ -24,33 +17,27 @@ jest.mock('field/username/username_pane', function () {
|
|
|
24
17
|
jest.mock('field/custom_input', function () {
|
|
25
18
|
return (0, _testUtils.mockComponent)('custom_input');
|
|
26
19
|
});
|
|
27
|
-
|
|
28
20
|
jest.mock('core/index', function () {
|
|
29
21
|
return {
|
|
30
22
|
captcha: jest.fn()
|
|
31
23
|
};
|
|
32
24
|
});
|
|
33
|
-
|
|
34
25
|
jest.mock('engine/classic', function () {
|
|
35
26
|
return {
|
|
36
27
|
isSSOEnabled: jest.fn()
|
|
37
28
|
};
|
|
38
29
|
});
|
|
39
|
-
|
|
40
30
|
jest.mock('connection/enterprise', function () {
|
|
41
31
|
return {
|
|
42
32
|
isHRDDomain: jest.fn()
|
|
43
33
|
};
|
|
44
34
|
});
|
|
45
|
-
|
|
46
35
|
var getComponent = function getComponent() {
|
|
47
36
|
return require('engine/classic/sign_up_pane').default;
|
|
48
37
|
};
|
|
49
|
-
|
|
50
38
|
describe('SignUpPane', function () {
|
|
51
39
|
beforeEach(function () {
|
|
52
40
|
jest.resetModules();
|
|
53
|
-
|
|
54
41
|
jest.mock('connection/database/index', function () {
|
|
55
42
|
return {
|
|
56
43
|
additionalSignUpFields: function additionalSignUpFields() {
|
|
@@ -74,17 +61,15 @@ describe('SignUpPane', function () {
|
|
|
74
61
|
var defaultProps = {
|
|
75
62
|
i18n: {
|
|
76
63
|
str: function str() {
|
|
77
|
-
for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
|
|
64
|
+
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
78
65
|
keys[_key] = arguments[_key];
|
|
79
66
|
}
|
|
80
|
-
|
|
81
67
|
return keys.join(',');
|
|
82
68
|
},
|
|
83
69
|
html: function html() {
|
|
84
|
-
for (var _len2 = arguments.length, keys = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
70
|
+
for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
85
71
|
keys[_key2] = arguments[_key2];
|
|
86
72
|
}
|
|
87
|
-
|
|
88
73
|
return keys.join(',');
|
|
89
74
|
}
|
|
90
75
|
},
|
|
@@ -98,75 +83,68 @@ describe('SignUpPane', function () {
|
|
|
98
83
|
};
|
|
99
84
|
it('renders only email by default', function () {
|
|
100
85
|
var Component = getComponent();
|
|
101
|
-
|
|
102
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
86
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
103
87
|
});
|
|
104
88
|
it('shows header when instructions are available', function () {
|
|
105
89
|
var Component = getComponent();
|
|
106
|
-
|
|
107
|
-
|
|
90
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
|
|
91
|
+
instructions: "instructions"
|
|
92
|
+
}))).toMatchSnapshot();
|
|
108
93
|
});
|
|
109
|
-
|
|
110
94
|
it('shows the Captcha pane', function () {
|
|
111
95
|
require('core/index').captcha.mockReturnValue({
|
|
112
96
|
get: function get() {
|
|
113
97
|
return true;
|
|
114
98
|
}
|
|
115
99
|
});
|
|
116
|
-
|
|
117
100
|
require('engine/classic').isSSOEnabled.mockReturnValue(false);
|
|
118
|
-
|
|
119
101
|
var Component = getComponent();
|
|
120
|
-
|
|
121
|
-
(0, _testUtils2.expectShallowComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
102
|
+
(0, _testUtils2.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
122
103
|
});
|
|
123
|
-
|
|
124
104
|
it('hides the Captcha pane for SSO connections', function () {
|
|
125
105
|
require('core/index').captcha.mockReturnValue({
|
|
126
106
|
get: function get() {
|
|
127
107
|
return true;
|
|
128
108
|
}
|
|
129
109
|
});
|
|
130
|
-
|
|
131
110
|
require('engine/classic').isSSOEnabled.mockReturnValue(true);
|
|
132
|
-
|
|
133
111
|
var Component = getComponent();
|
|
134
|
-
|
|
135
|
-
(0, _testUtils2.expectShallowComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
112
|
+
(0, _testUtils2.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
136
113
|
});
|
|
137
|
-
|
|
138
114
|
it('shows the Captcha pane for SSO (ADFS) connections', function () {
|
|
139
115
|
require('core/index').captcha.mockReturnValue({
|
|
140
116
|
get: function get() {
|
|
141
117
|
return true;
|
|
142
118
|
}
|
|
143
119
|
});
|
|
144
|
-
|
|
145
120
|
require('engine/classic').isSSOEnabled.mockReturnValue(true);
|
|
146
121
|
require('connection/enterprise').isHRDDomain.mockReturnValue(true);
|
|
147
|
-
|
|
148
122
|
var Component = getComponent();
|
|
149
|
-
|
|
150
|
-
(0, _testUtils2.expectShallowComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
123
|
+
(0, _testUtils2.expectShallowComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
151
124
|
});
|
|
152
|
-
|
|
153
125
|
describe('onlyEmail is false', function () {
|
|
154
126
|
it('shows PasswordPane', function () {
|
|
155
127
|
var Component = getComponent();
|
|
156
|
-
|
|
157
|
-
|
|
128
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
|
|
129
|
+
onlyEmail: false
|
|
130
|
+
}))).toMatchSnapshot();
|
|
158
131
|
});
|
|
159
132
|
it('shows custom fields when additionalSignUpFields returns additional fields', function () {
|
|
160
133
|
require('connection/database/index').additionalSignUpFields = function () {
|
|
161
|
-
return [{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
134
|
+
return [{
|
|
135
|
+
get: function get(key) {
|
|
136
|
+
return "".concat(key, "1");
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
get: function get(key) {
|
|
140
|
+
return "".concat(key, "2");
|
|
141
|
+
}
|
|
142
|
+
}];
|
|
166
143
|
};
|
|
167
144
|
var Component = getComponent();
|
|
168
|
-
|
|
169
|
-
|
|
145
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
|
|
146
|
+
onlyEmail: false
|
|
147
|
+
}))).toMatchSnapshot();
|
|
170
148
|
});
|
|
171
149
|
it('shows UsernamePane when databaseConnectionRequiresUsername is true and signUpHideUsernameField is false', function () {
|
|
172
150
|
require('connection/database/index').databaseConnectionRequiresUsername = function () {
|
|
@@ -176,8 +154,9 @@ describe('SignUpPane', function () {
|
|
|
176
154
|
return false;
|
|
177
155
|
};
|
|
178
156
|
var Component = getComponent();
|
|
179
|
-
|
|
180
|
-
|
|
157
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, _extends({}, defaultProps, {
|
|
158
|
+
onlyEmail: false
|
|
159
|
+
}))).toMatchSnapshot();
|
|
181
160
|
});
|
|
182
161
|
it('hide UsernamePane when databaseConnectionRequiresUsername is true and signUpHideUsernameField is true', function () {
|
|
183
162
|
require('connection/database/index').databaseConnectionRequiresUsername = function () {
|
|
@@ -187,8 +166,7 @@ describe('SignUpPane', function () {
|
|
|
187
166
|
return true;
|
|
188
167
|
};
|
|
189
168
|
var Component = getComponent();
|
|
190
|
-
|
|
191
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
169
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Component, defaultProps)).toMatchSnapshot();
|
|
192
170
|
});
|
|
193
171
|
});
|
|
194
172
|
});
|