auth0-lock 11.30.4 → 11.31.1
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/.circleci/config.yml +66 -19
- package/.eslintrc.json +9 -2
- package/.prettierignore +1 -0
- package/.prettierrc.yaml +5 -0
- package/.shiprc +7 -0
- package/CHANGELOG.md +393 -210
- package/DEVELOPMENT.md +13 -3
- package/LICENSE +23 -0
- package/README.md +163 -140
- package/karma.conf.js +129 -0
- package/lib/__tests__/connection/database/reset_password.js +82 -4
- package/lib/__tests__/connection/enterprise/actions.js +19 -0
- package/lib/__tests__/core/index.js +134 -0
- package/lib/__tests__/core/web_api/helper.js +3 -3
- package/lib/__tests__/core/web_api.js +7 -7
- package/lib/__tests__/setup-tests.js +1 -1
- package/lib/__tests__/ui/box/chrome.js +16 -3
- package/lib/__tests__/utils/format.js +33 -0
- package/lib/browser.js +12 -10
- package/lib/connection/captcha.js +94 -0
- package/lib/connection/database/actions.js +9 -69
- package/lib/connection/database/index.js +2 -2
- package/lib/connection/database/login_pane.js +3 -1
- package/lib/connection/database/reset_password.js +15 -0
- package/lib/connection/enterprise/actions.js +10 -0
- package/lib/core/actions.js +3 -3
- package/lib/core/index.js +11 -18
- package/lib/core/web_api/helper.js +1 -1
- package/lib/core.js +1 -1
- package/lib/engine/classic/login.js +2 -2
- package/lib/engine/classic/sign_up_pane.js +2 -2
- package/lib/i18n.js +11 -7
- package/lib/lock.js +1 -1
- package/lib/passwordless.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/sync.js +1 -1
- package/lib/ui/box/chrome.js +16 -5
- package/lib/ui/box/container.js +4 -4
- package/lib/ui/box/header.js +9 -4
- package/lib/ui/box.js +5 -5
- package/lib/ui/input/password/password_strength.js +3 -3
- package/lib/utils/cdn_utils.js +6 -6
- package/lib/utils/format.js +48 -0
- package/package.json +40 -36
- package/.zuul.yml +0 -19
- package/circle.yml +0 -19
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.showMissingCaptcha = showMissingCaptcha;
|
|
5
|
+
exports.setCaptchaParams = setCaptchaParams;
|
|
6
|
+
exports.swapCaptcha = swapCaptcha;
|
|
7
|
+
|
|
8
|
+
var _index = require('../core/index');
|
|
9
|
+
|
|
10
|
+
var l = _interopRequireWildcard(_index);
|
|
11
|
+
|
|
12
|
+
var _index2 = require('../field/index');
|
|
13
|
+
|
|
14
|
+
var c = _interopRequireWildcard(_index2);
|
|
15
|
+
|
|
16
|
+
var _i18n = require('../i18n');
|
|
17
|
+
|
|
18
|
+
var i18n = _interopRequireWildcard(_i18n);
|
|
19
|
+
|
|
20
|
+
var _index3 = require('../store/index');
|
|
21
|
+
|
|
22
|
+
var _web_api = require('../core/web_api');
|
|
23
|
+
|
|
24
|
+
var _web_api2 = _interopRequireDefault(_web_api);
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Display the error message of missing captcha in the header of lock.
|
|
32
|
+
*
|
|
33
|
+
* @param {Object} m model
|
|
34
|
+
* @param {Number} id
|
|
35
|
+
*/
|
|
36
|
+
function showMissingCaptcha(m, id) {
|
|
37
|
+
var captchaConfig = l.captcha(m);
|
|
38
|
+
|
|
39
|
+
var captchaError = captchaConfig.get('provider') === 'recaptcha_v2' ? 'invalid_recaptcha' : 'invalid_captcha';
|
|
40
|
+
|
|
41
|
+
var errorMessage = i18n.html(m, ['error', 'login', captchaError]);
|
|
42
|
+
|
|
43
|
+
(0, _index3.swap)(_index3.updateEntity, 'lock', id, function (m) {
|
|
44
|
+
m = l.setSubmitting(m, false, errorMessage);
|
|
45
|
+
return c.showInvalidField(m, 'captcha');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return m;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Set the captcha value in the fields object before sending the request.
|
|
53
|
+
*
|
|
54
|
+
* @param {Object} m model
|
|
55
|
+
* @param {Object} params
|
|
56
|
+
* @param {Object} fields
|
|
57
|
+
*
|
|
58
|
+
* @returns {Boolean} returns true if is required and missing the response from the user
|
|
59
|
+
*/
|
|
60
|
+
function setCaptchaParams(m, params, fields) {
|
|
61
|
+
var captchaConfig = l.captcha(m);
|
|
62
|
+
var isCaptchaRequired = captchaConfig && l.captcha(m).get('required');
|
|
63
|
+
|
|
64
|
+
if (!isCaptchaRequired) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
var captcha = c.getFieldValue(m, 'captcha');
|
|
68
|
+
//captcha required and missing
|
|
69
|
+
if (!captcha) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
params['captcha'] = captcha;
|
|
74
|
+
fields.push('captcha');
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get a new challenge and display the new captcha image.
|
|
80
|
+
*
|
|
81
|
+
* @param {number} id The id of the Lock instance.
|
|
82
|
+
* @param {boolean} wasInvalid A boolean indicating if the previous captcha was invalid.
|
|
83
|
+
* @param {Function} [next] A callback.
|
|
84
|
+
*/
|
|
85
|
+
function swapCaptcha(id, wasInvalid, next) {
|
|
86
|
+
return _web_api2.default.getChallenge(id, function (err, newCaptcha) {
|
|
87
|
+
if (!err && newCaptcha) {
|
|
88
|
+
(0, _index3.swap)(_index3.updateEntity, 'lock', id, l.setCaptcha, newCaptcha, wasInvalid);
|
|
89
|
+
}
|
|
90
|
+
if (next) {
|
|
91
|
+
next();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
@@ -12,7 +12,6 @@ exports.cancelResetPassword = cancelResetPassword;
|
|
|
12
12
|
exports.cancelMFALogin = cancelMFALogin;
|
|
13
13
|
exports.toggleTermsAcceptance = toggleTermsAcceptance;
|
|
14
14
|
exports.showLoginMFAActivity = showLoginMFAActivity;
|
|
15
|
-
exports.swapCaptcha = swapCaptcha;
|
|
16
15
|
|
|
17
16
|
var _immutable = require('immutable');
|
|
18
17
|
|
|
@@ -40,6 +39,8 @@ var _i18n = require('../../i18n');
|
|
|
40
39
|
|
|
41
40
|
var i18n = _interopRequireWildcard(_i18n);
|
|
42
41
|
|
|
42
|
+
var _captcha = require('../captcha');
|
|
43
|
+
|
|
43
44
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
44
45
|
|
|
45
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -58,9 +59,9 @@ function logIn(id) {
|
|
|
58
59
|
|
|
59
60
|
var fields = [usernameField, 'password'];
|
|
60
61
|
|
|
61
|
-
var isCaptchaValid = setCaptchaParams(m, params, fields);
|
|
62
|
+
var isCaptchaValid = (0, _captcha.setCaptchaParams)(m, params, fields);
|
|
62
63
|
if (!isCaptchaValid) {
|
|
63
|
-
return showMissingCaptcha(m, id);
|
|
64
|
+
return (0, _captcha.showMissingCaptcha)(m, id);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
var mfaCode = c.getFieldValue(m, 'mfa_code');
|
|
@@ -76,7 +77,7 @@ function logIn(id) {
|
|
|
76
77
|
|
|
77
78
|
if (error) {
|
|
78
79
|
var wasInvalid = error && error.code === 'invalid_captcha';
|
|
79
|
-
return swapCaptcha(id, wasInvalid, next);
|
|
80
|
+
return (0, _captcha.swapCaptcha)(id, wasInvalid, next);
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
next();
|
|
@@ -113,9 +114,9 @@ function signUp(id) {
|
|
|
113
114
|
autoLogin: (0, _index4.shouldAutoLogin)(m)
|
|
114
115
|
};
|
|
115
116
|
|
|
116
|
-
var isCaptchaValid = setCaptchaParams(m, params, fields);
|
|
117
|
+
var isCaptchaValid = (0, _captcha.setCaptchaParams)(m, params, fields);
|
|
117
118
|
if (!isCaptchaValid) {
|
|
118
|
-
return showMissingCaptcha(m, id);
|
|
119
|
+
return (0, _captcha.showMissingCaptcha)(m, id);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
if ((0, _index4.databaseConnectionRequiresUsername)(m)) {
|
|
@@ -155,7 +156,7 @@ function signUp(id) {
|
|
|
155
156
|
|
|
156
157
|
var wasInvalidCaptcha = error && error.code === 'invalid_captcha';
|
|
157
158
|
|
|
158
|
-
swapCaptcha(id, wasInvalidCaptcha, function () {
|
|
159
|
+
(0, _captcha.swapCaptcha)(id, wasInvalidCaptcha, function () {
|
|
159
160
|
setTimeout(function () {
|
|
160
161
|
return signUpError(id, error);
|
|
161
162
|
}, 250);
|
|
@@ -255,7 +256,7 @@ function signUpError(id, error) {
|
|
|
255
256
|
|
|
256
257
|
if (errorKey === 'invalid_captcha') {
|
|
257
258
|
errorMessage = i18n.html(m, ['error', 'login', errorKey]);
|
|
258
|
-
return swapCaptcha(id, true, function () {
|
|
259
|
+
return (0, _captcha.swapCaptcha)(id, true, function () {
|
|
259
260
|
(0, _index.swap)(_index.updateEntity, 'lock', id, l.setSubmitting, false, errorMessage);
|
|
260
261
|
});
|
|
261
262
|
}
|
|
@@ -360,64 +361,3 @@ function showLoginMFAActivity(id) {
|
|
|
360
361
|
|
|
361
362
|
(0, _index.swap)(_index.updateEntity, 'lock', id, _index4.setScreen, 'mfaLogin', fields);
|
|
362
363
|
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Get a new challenge and display the new captcha image.
|
|
366
|
-
*
|
|
367
|
-
* @param {number} id The id of the Lock instance.
|
|
368
|
-
* @param {boolean} wasInvalid A boolean indicating if the previous captcha was invalid.
|
|
369
|
-
* @param {Function} [next] A callback.
|
|
370
|
-
*/
|
|
371
|
-
function swapCaptcha(id, wasInvalid, next) {
|
|
372
|
-
return _web_api2.default.getChallenge(id, function (err, newCaptcha) {
|
|
373
|
-
if (!err && newCaptcha) {
|
|
374
|
-
(0, _index.swap)(_index.updateEntity, 'lock', id, l.setCaptcha, newCaptcha, wasInvalid);
|
|
375
|
-
}
|
|
376
|
-
if (next) {
|
|
377
|
-
next();
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Display the error message of missing captcha in the header of lock.
|
|
384
|
-
*
|
|
385
|
-
* @param {Object} m model
|
|
386
|
-
* @param {Number} id
|
|
387
|
-
*/
|
|
388
|
-
function showMissingCaptcha(m, id) {
|
|
389
|
-
var captchaConfig = l.captcha(m);
|
|
390
|
-
var captchaError = captchaConfig.get('provider') === 'recaptcha_v2' ? 'invalid_recaptcha' : 'invalid_captcha';
|
|
391
|
-
var errorMessage = i18n.html(m, ['error', 'login', captchaError]);
|
|
392
|
-
(0, _index.swap)(_index.updateEntity, 'lock', id, function (m) {
|
|
393
|
-
m = l.setSubmitting(m, false, errorMessage);
|
|
394
|
-
return c.showInvalidField(m, 'captcha');
|
|
395
|
-
});
|
|
396
|
-
return m;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Set the captcha value in the fields object before sending the request.
|
|
401
|
-
*
|
|
402
|
-
* @param {Object} m model
|
|
403
|
-
* @param {Object} params
|
|
404
|
-
* @param {Object} fields
|
|
405
|
-
*
|
|
406
|
-
* @returns {Boolean} returns true if is required and missing the response from the user
|
|
407
|
-
*/
|
|
408
|
-
function setCaptchaParams(m, params, fields) {
|
|
409
|
-
var captchaConfig = l.captcha(m);
|
|
410
|
-
var isCaptchaRequired = captchaConfig && l.captcha(m).get('required');
|
|
411
|
-
if (!isCaptchaRequired) {
|
|
412
|
-
return true;
|
|
413
|
-
}
|
|
414
|
-
var captcha = c.getFieldValue(m, 'captcha');
|
|
415
|
-
//captcha required and missing
|
|
416
|
-
if (!captcha) {
|
|
417
|
-
return false;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
params['captcha'] = captcha;
|
|
421
|
-
fields.push('captcha');
|
|
422
|
-
return true;
|
|
423
|
-
}
|
|
@@ -92,7 +92,7 @@ function assertMaybeString(opts, name) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
function assertMaybeArray(opts, name) {
|
|
95
|
-
var valid = opts[name] === undefined ||
|
|
95
|
+
var valid = opts[name] === undefined || window.Array.isArray(opts[name]);
|
|
96
96
|
if (!valid) l.warn(opts, 'The `' + name + '` option will be ignored, because it is not an array.');
|
|
97
97
|
return valid;
|
|
98
98
|
}
|
|
@@ -208,7 +208,7 @@ function processDatabaseOptions(opts) {
|
|
|
208
208
|
options = undefined;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
if (options != undefined && !
|
|
211
|
+
if (options != undefined && !window.Array.isArray(options) && typeof options != 'function' || type === 'select' && options === undefined) {
|
|
212
212
|
l.warn(opts, 'Ignoring an element of `additionalSignUpFields` (' + name + ') because it has a "select" `type` but does not specify an `options` property that is an Array or a function.');
|
|
213
213
|
filter = false;
|
|
214
214
|
}
|
|
@@ -24,6 +24,8 @@ var _password_pane2 = _interopRequireDefault(_password_pane);
|
|
|
24
24
|
|
|
25
25
|
var _actions = require('./actions');
|
|
26
26
|
|
|
27
|
+
var _captcha = require('../captcha');
|
|
28
|
+
|
|
27
29
|
var _index = require('./index');
|
|
28
30
|
|
|
29
31
|
var _index2 = require('../../core/index');
|
|
@@ -103,7 +105,7 @@ var LoginPane = function (_React$Component) {
|
|
|
103
105
|
});
|
|
104
106
|
|
|
105
107
|
var captchaPane = l.captcha(lock) && l.captcha(lock).get('required') ? _react2.default.createElement(_captcha_pane2.default, { i18n: i18n, lock: lock, onReload: function onReload() {
|
|
106
|
-
return (0,
|
|
108
|
+
return (0, _captcha.swapCaptcha)(l.id(lock), false);
|
|
107
109
|
} }) : null;
|
|
108
110
|
|
|
109
111
|
var dontRememberPassword = showForgotPasswordLink && (0, _index.hasScreen)(lock, 'forgotPassword') ? _react2.default.createElement(
|
|
@@ -34,6 +34,10 @@ var l = _interopRequireWildcard(_index3);
|
|
|
34
34
|
|
|
35
35
|
var _index4 = require('../../store/index');
|
|
36
36
|
|
|
37
|
+
var _email = require('../../field/email');
|
|
38
|
+
|
|
39
|
+
var _field = require('../../field');
|
|
40
|
+
|
|
37
41
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
38
42
|
|
|
39
43
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -54,6 +58,17 @@ var Component = function Component(_ref) {
|
|
|
54
58
|
null,
|
|
55
59
|
headerText
|
|
56
60
|
);
|
|
61
|
+
var connectionResolver = l.connectionResolver(model);
|
|
62
|
+
|
|
63
|
+
// When using a custom connection resolver, `usernameStyle` is always 'username' (as opposed to 'email').
|
|
64
|
+
// If the user has entered an email address as the username, and a custom resolver is being used, copy the
|
|
65
|
+
// value from the 'username' field to the 'email' field so that `EmailPane` can render it.
|
|
66
|
+
if (connectionResolver) {
|
|
67
|
+
var field = (0, _field.getField)(model, 'username');
|
|
68
|
+
var value = field.get('value', '');
|
|
69
|
+
|
|
70
|
+
(0, _index4.swap)(_index4.updateEntity, 'lock', l.id(model), _email.setEmail, (0, _email.isEmail)(value, false) ? value : '', false);
|
|
71
|
+
}
|
|
57
72
|
|
|
58
73
|
return _react2.default.createElement(_reset_password_pane2.default, {
|
|
59
74
|
emailInputPlaceholder: i18n.str('emailInputPlaceholder'),
|
|
@@ -30,6 +30,8 @@ var _index3 = require('../../core/index');
|
|
|
30
30
|
|
|
31
31
|
var l = _interopRequireWildcard(_index3);
|
|
32
32
|
|
|
33
|
+
var _captcha = require('../captcha');
|
|
34
|
+
|
|
33
35
|
var _index4 = require('../database/index');
|
|
34
36
|
|
|
35
37
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
@@ -57,11 +59,19 @@ function logIn(id) {
|
|
|
57
59
|
var ssoConnection = (0, _enterprise.matchConnection)(m, email);
|
|
58
60
|
var enterpriseConnection = (0, _enterprise.enterpriseActiveFlowConnection)(m);
|
|
59
61
|
var connectionScopes = getConnectionScopesFrom(m, ssoConnection || enterpriseConnection);
|
|
62
|
+
var usernameField = (0, _index4.databaseLogInWithEmail)(m) ? 'email' : 'username';
|
|
63
|
+
var fields = [usernameField, 'password'];
|
|
60
64
|
|
|
61
65
|
var params = {
|
|
62
66
|
connection_scope: connectionScopes ? connectionScopes.toJS() : undefined
|
|
63
67
|
};
|
|
64
68
|
|
|
69
|
+
var isCaptchaValid = (0, _captcha.setCaptchaParams)(m, params, fields);
|
|
70
|
+
|
|
71
|
+
if (!isCaptchaValid) {
|
|
72
|
+
return (0, _captcha.showMissingCaptcha)(m, id);
|
|
73
|
+
}
|
|
74
|
+
|
|
65
75
|
if (ssoConnection && !(0, _enterprise.isHRDActive)(m)) {
|
|
66
76
|
return logInSSO(id, ssoConnection, params);
|
|
67
77
|
}
|
package/lib/core/actions.js
CHANGED
|
@@ -67,14 +67,14 @@ function handleAuthCallback() {
|
|
|
67
67
|
var keepHash = ms.filter(function (m) {
|
|
68
68
|
return !l.hashCleanup(m);
|
|
69
69
|
}).size > 0;
|
|
70
|
-
var urlWithoutHash =
|
|
70
|
+
var urlWithoutHash = window.location.href.split('#')[0];
|
|
71
71
|
var callback = function callback(error, authResult) {
|
|
72
72
|
var parsed = !!(error || authResult);
|
|
73
73
|
if (parsed && !keepHash) {
|
|
74
|
-
|
|
74
|
+
window.history.replaceState(null, '', urlWithoutHash);
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
resumeAuth(
|
|
77
|
+
resumeAuth(window.location.hash, callback);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
function resumeAuth(hash, callback) {
|
package/lib/core/index.js
CHANGED
|
@@ -304,7 +304,8 @@ function extractUIOptions(id, options) {
|
|
|
304
304
|
authButtonsTheme: (typeof authButtons === 'undefined' ? 'undefined' : _typeof(authButtons)) === 'object' ? authButtons : {},
|
|
305
305
|
allowShowPassword: !!options.allowShowPassword,
|
|
306
306
|
allowPasswordAutocomplete: !!options.allowPasswordAutocomplete,
|
|
307
|
-
scrollGlobalMessagesIntoView: undefined === options.scrollGlobalMessagesIntoView ? true : !!options.scrollGlobalMessagesIntoView
|
|
307
|
+
scrollGlobalMessagesIntoView: undefined === options.scrollGlobalMessagesIntoView ? true : !!options.scrollGlobalMessagesIntoView,
|
|
308
|
+
forceAutoHeight: !!options.forceAutoHeight
|
|
308
309
|
});
|
|
309
310
|
}
|
|
310
311
|
|
|
@@ -401,6 +402,9 @@ var ui = exports.ui = {
|
|
|
401
402
|
},
|
|
402
403
|
allowPasswordAutocomplete: function allowPasswordAutocomplete(m) {
|
|
403
404
|
return tget(m, 'allowPasswordAutocomplete', getUIAttribute(m, 'allowPasswordAutocomplete'));
|
|
405
|
+
},
|
|
406
|
+
forceAutoHeight: function forceAutoHeight(m) {
|
|
407
|
+
return tget(m, 'forceAutoHeight', getUIAttribute(m, 'forceAutoHeight'));
|
|
404
408
|
}
|
|
405
409
|
};
|
|
406
410
|
|
|
@@ -502,16 +506,7 @@ function extractClientBaseUrlOption(opts, domain) {
|
|
|
502
506
|
return opts.assetsUrl;
|
|
503
507
|
}
|
|
504
508
|
|
|
505
|
-
|
|
506
|
-
var hostname = (0, _url_utils.getLocationFromUrl)(domainUrl).hostname;
|
|
507
|
-
var DOT_AUTH0_DOT_COM = '.auth0.com';
|
|
508
|
-
var AUTH0_US_CDN_URL = 'https://cdn.auth0.com';
|
|
509
|
-
if ((0, _string_utils.endsWith)(hostname, DOT_AUTH0_DOT_COM)) {
|
|
510
|
-
var parts = hostname.split('.');
|
|
511
|
-
return parts.length > 3 ? 'https://cdn.' + parts[parts.length - 3] + DOT_AUTH0_DOT_COM : AUTH0_US_CDN_URL;
|
|
512
|
-
} else {
|
|
513
|
-
return domainUrl;
|
|
514
|
-
}
|
|
509
|
+
return 'https://' + domain;
|
|
515
510
|
}
|
|
516
511
|
|
|
517
512
|
function extractTenantBaseUrlOption(opts, domain) {
|
|
@@ -530,16 +525,14 @@ function extractTenantBaseUrlOption(opts, domain) {
|
|
|
530
525
|
var domainUrl = 'https://' + domain;
|
|
531
526
|
var hostname = (0, _url_utils.getLocationFromUrl)(domainUrl).hostname;
|
|
532
527
|
var DOT_AUTH0_DOT_COM = '.auth0.com';
|
|
533
|
-
var AUTH0_US_CDN_URL = 'https://cdn.auth0.com';
|
|
534
|
-
|
|
535
|
-
var parts = hostname.split('.');
|
|
536
|
-
var tenant_name = parts[0];
|
|
537
|
-
var domain;
|
|
538
528
|
|
|
529
|
+
// prettier-ignore
|
|
539
530
|
if ((0, _string_utils.endsWith)(hostname, DOT_AUTH0_DOT_COM)) {
|
|
540
|
-
|
|
531
|
+
// lgtm [js/incomplete-url-substring-sanitization]
|
|
532
|
+
var parts = hostname.split('.');
|
|
533
|
+
var tenant_name = parts[0];
|
|
541
534
|
|
|
542
|
-
return (0, _urlJoin2.default)(
|
|
535
|
+
return (0, _urlJoin2.default)(domainUrl, 'tenants', 'v1', tenant_name + '.js');
|
|
543
536
|
} else {
|
|
544
537
|
return (0, _urlJoin2.default)(domainUrl, 'info-v1.js');
|
|
545
538
|
}
|