auth0-lock 11.30.5 → 11.32.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/.circleci/config.yml +11 -7
- package/.eslintrc.json +9 -2
- package/.prettierignore +1 -0
- package/.prettierrc.yaml +5 -0
- package/.shiprc +2 -1
- package/CHANGELOG.md +389 -210
- package/README.md +162 -140
- package/karma.conf.js +4 -10
- package/lib/__tests__/connection/database/login_pane.js +93 -0
- package/lib/__tests__/connection/database/reset_password.js +82 -4
- package/lib/__tests__/connection/enterprise/actions.js +25 -2
- package/lib/__tests__/engine/classic/login.js +0 -2
- package/lib/__tests__/engine/classic/sign_up_pane.js +67 -2
- package/lib/__tests__/testUtils.js +17 -1
- package/lib/__tests__/ui/box/chrome.js +18 -2
- package/lib/__tests__/ui/input/password_input.js +4 -1
- package/lib/browser.js +12 -10
- package/lib/connection/captcha.js +94 -0
- package/lib/connection/database/actions.js +11 -69
- package/lib/connection/database/login_pane.js +11 -2
- package/lib/connection/database/reset_password.js +15 -0
- package/lib/connection/enterprise/actions.js +10 -0
- package/lib/core/index.js +5 -1
- 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 +8 -3
- package/lib/field/captcha/captcha_pane.js +0 -4
- package/lib/i18n.js +7 -5
- package/lib/lock.js +1 -1
- package/lib/passwordless.js +1 -1
- package/lib/ui/box/chrome.js +20 -5
- package/lib/ui/box/container.js +2 -2
- package/lib/ui/box/header.js +5 -0
- package/lib/ui/input/password_input.js +1 -0
- package/lib/utils/cdn_utils.js +1 -1
- package/package.json +20 -23
- package/local.log +0 -8
- package/yarn-error.log +0 -11514
|
@@ -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 }; }
|
|
@@ -50,6 +51,7 @@ function logIn(id) {
|
|
|
50
51
|
var m = (0, _index.read)(_index.getEntity, 'lock', id);
|
|
51
52
|
var usernameField = (0, _index4.databaseLogInWithEmail)(m) ? 'email' : 'username';
|
|
52
53
|
var username = c.getFieldValue(m, usernameField);
|
|
54
|
+
|
|
53
55
|
var params = {
|
|
54
56
|
connection: (0, _index4.databaseConnectionName)(m),
|
|
55
57
|
username: username,
|
|
@@ -57,13 +59,14 @@ function logIn(id) {
|
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
var fields = [usernameField, 'password'];
|
|
62
|
+
var isCaptchaValid = (0, _captcha.setCaptchaParams)(m, params, fields);
|
|
60
63
|
|
|
61
|
-
var isCaptchaValid = setCaptchaParams(m, params, fields);
|
|
62
64
|
if (!isCaptchaValid) {
|
|
63
|
-
return showMissingCaptcha(m, id);
|
|
65
|
+
return (0, _captcha.showMissingCaptcha)(m, id);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
var mfaCode = c.getFieldValue(m, 'mfa_code');
|
|
69
|
+
|
|
67
70
|
if (needsMFA) {
|
|
68
71
|
params['mfa_code'] = mfaCode;
|
|
69
72
|
fields.push('mfa_code');
|
|
@@ -76,7 +79,7 @@ function logIn(id) {
|
|
|
76
79
|
|
|
77
80
|
if (error) {
|
|
78
81
|
var wasInvalid = error && error.code === 'invalid_captcha';
|
|
79
|
-
return swapCaptcha(id, wasInvalid, next);
|
|
82
|
+
return (0, _captcha.swapCaptcha)(id, wasInvalid, next);
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
next();
|
|
@@ -113,9 +116,9 @@ function signUp(id) {
|
|
|
113
116
|
autoLogin: (0, _index4.shouldAutoLogin)(m)
|
|
114
117
|
};
|
|
115
118
|
|
|
116
|
-
var isCaptchaValid = setCaptchaParams(m, params, fields);
|
|
119
|
+
var isCaptchaValid = (0, _captcha.setCaptchaParams)(m, params, fields);
|
|
117
120
|
if (!isCaptchaValid) {
|
|
118
|
-
return showMissingCaptcha(m, id);
|
|
121
|
+
return (0, _captcha.showMissingCaptcha)(m, id);
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
if ((0, _index4.databaseConnectionRequiresUsername)(m)) {
|
|
@@ -155,7 +158,7 @@ function signUp(id) {
|
|
|
155
158
|
|
|
156
159
|
var wasInvalidCaptcha = error && error.code === 'invalid_captcha';
|
|
157
160
|
|
|
158
|
-
swapCaptcha(id, wasInvalidCaptcha, function () {
|
|
161
|
+
(0, _captcha.swapCaptcha)(id, wasInvalidCaptcha, function () {
|
|
159
162
|
setTimeout(function () {
|
|
160
163
|
return signUpError(id, error);
|
|
161
164
|
}, 250);
|
|
@@ -255,7 +258,7 @@ function signUpError(id, error) {
|
|
|
255
258
|
|
|
256
259
|
if (errorKey === 'invalid_captcha') {
|
|
257
260
|
errorMessage = i18n.html(m, ['error', 'login', errorKey]);
|
|
258
|
-
return swapCaptcha(id, true, function () {
|
|
261
|
+
return (0, _captcha.swapCaptcha)(id, true, function () {
|
|
259
262
|
(0, _index.swap)(_index.updateEntity, 'lock', id, l.setSubmitting, false, errorMessage);
|
|
260
263
|
});
|
|
261
264
|
}
|
|
@@ -360,64 +363,3 @@ function showLoginMFAActivity(id) {
|
|
|
360
363
|
|
|
361
364
|
(0, _index.swap)(_index.updateEntity, 'lock', id, _index4.setScreen, 'mfaLogin', fields);
|
|
362
365
|
}
|
|
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
|
-
}
|
|
@@ -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');
|
|
@@ -34,6 +36,12 @@ var _captcha_pane = require('../../field/captcha/captcha_pane');
|
|
|
34
36
|
|
|
35
37
|
var _captcha_pane2 = _interopRequireDefault(_captcha_pane);
|
|
36
38
|
|
|
39
|
+
var _classic = require('../../engine/classic');
|
|
40
|
+
|
|
41
|
+
var _enterprise = require('../enterprise');
|
|
42
|
+
|
|
43
|
+
var _database = require('../database');
|
|
44
|
+
|
|
37
45
|
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
46
|
|
|
39
47
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -83,6 +91,7 @@ var LoginPane = function (_React$Component) {
|
|
|
83
91
|
headerText
|
|
84
92
|
);
|
|
85
93
|
var resolver = l.connectionResolver(lock);
|
|
94
|
+
var sso = (0, _classic.isSSOEnabled)(lock);
|
|
86
95
|
|
|
87
96
|
// Should never validate format on login because of custom db connection and import mode.
|
|
88
97
|
// If a custom resolver is in use, always use UsernamePane without validating format,
|
|
@@ -102,8 +111,8 @@ var LoginPane = function (_React$Component) {
|
|
|
102
111
|
strictValidation: false
|
|
103
112
|
});
|
|
104
113
|
|
|
105
|
-
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,
|
|
114
|
+
var captchaPane = l.captcha(lock) && l.captcha(lock).get('required') && ((0, _enterprise.isHRDDomain)(lock, (0, _database.databaseUsernameValue)(lock)) || !sso) ? _react2.default.createElement(_captcha_pane2.default, { i18n: i18n, lock: lock, onReload: function onReload() {
|
|
115
|
+
return (0, _captcha.swapCaptcha)(l.id(lock), false);
|
|
107
116
|
} }) : null;
|
|
108
117
|
|
|
109
118
|
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,6 +59,8 @@ 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
|
|
@@ -66,6 +70,12 @@ function logIn(id) {
|
|
|
66
70
|
return logInSSO(id, ssoConnection, params);
|
|
67
71
|
}
|
|
68
72
|
|
|
73
|
+
var isCaptchaValid = (0, _captcha.setCaptchaParams)(m, params, fields);
|
|
74
|
+
|
|
75
|
+
if (!isCaptchaValid && !ssoConnection) {
|
|
76
|
+
return (0, _captcha.showMissingCaptcha)(m, id);
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
logInActiveFlow(id, params);
|
|
70
80
|
}
|
|
71
81
|
|
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
|
|