auth0-lock 11.30.6 → 11.31.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/.shiprc +1 -1
- package/CHANGELOG.md +9 -0
- package/README.md +2 -1
- package/lib/__tests__/connection/database/reset_password.js +82 -4
- package/lib/__tests__/ui/box/chrome.js +16 -3
- package/lib/connection/database/reset_password.js +15 -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/i18n.js +1 -1
- package/lib/lock.js +1 -1
- package/lib/passwordless.js +1 -1
- package/lib/ui/box/chrome.js +15 -4
- package/package.json +3 -2
package/.shiprc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [v11.31.0](https://github.com/auth0/lock/tree/v11.31.0) (2021-10-15)
|
|
4
|
+
[Full Changelog](https://github.com/auth0/lock/compare/v11.30.6...v11.31.0)
|
|
5
|
+
|
|
6
|
+
**Added**
|
|
7
|
+
- [SDK-2295] Add forceAutoHeight property to UI config [\#2050](https://github.com/auth0/lock/pull/2050) ([stevehobbsdev](https://github.com/stevehobbsdev))
|
|
8
|
+
|
|
9
|
+
**Fixed**
|
|
10
|
+
- [SDK-2823] Fix password reset when using custom connection resolver [\#2048](https://github.com/auth0/lock/pull/2048) ([stevehobbsdev](https://github.com/stevehobbsdev))
|
|
11
|
+
|
|
3
12
|
## [v11.30.6](https://github.com/auth0/lock/tree/v11.30.6) (2021-09-27)
|
|
4
13
|
|
|
5
14
|
[Full Changelog](https://github.com/auth0/lock/compare/v11.30.5...v11.30.6)
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ From CDN
|
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
27
|
<!-- Latest patch release (recommended for production) -->
|
|
28
|
-
<script src="https://cdn.auth0.com/js/lock/11.
|
|
28
|
+
<script src="https://cdn.auth0.com/js/lock/11.31.0/lock.min.js"></script>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
From [npm](https://npmjs.org)
|
|
@@ -272,6 +272,7 @@ The appearance of the widget and the mechanics of authentication can be customiz
|
|
|
272
272
|
- **allowShowPassword {Boolean}**: Determines whether or not add a checkbox to show the password when typing it. Defaults to `false`.
|
|
273
273
|
- **allowPasswordAutocomplete {Boolean}**: Determines whether the password field will allow autocomplete; setting this to `true` is required for password manager support and to avoid many cases of adverse behavior. Defaults to `false`.
|
|
274
274
|
- **preferConnectionDisplayName {Boolean}**: If true, Lock will try to use the connection display name as configured in the manage dashboard, if available.
|
|
275
|
+
- **forceAutoHeight {Boolean}**: If true, Lock will use the `height: auto!important` style on the wrapping div, which may be useful in some circumstances where `height: 100vh` is undesirable (see [\#1963](https://github.com/auth0/lock/issues/1963)). Defaults to `false`.
|
|
275
276
|
|
|
276
277
|
#### Theming options
|
|
277
278
|
|
|
@@ -4,15 +4,30 @@ var _react = require('react');
|
|
|
4
4
|
|
|
5
5
|
var _react2 = _interopRequireDefault(_react);
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _testUtils = require('testUtils');
|
|
8
|
+
|
|
9
|
+
var _immutable = require('immutable');
|
|
10
|
+
|
|
11
|
+
var _immutable2 = _interopRequireDefault(_immutable);
|
|
12
|
+
|
|
13
|
+
var _field = require('../../../field');
|
|
8
14
|
|
|
9
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
16
|
|
|
17
|
+
jest.mock('connection/database/reset_password_pane', function () {
|
|
18
|
+
return (0, _testUtils.mockComponent)('reset_password_pane');
|
|
19
|
+
});
|
|
20
|
+
|
|
11
21
|
var getScreen = function getScreen() {
|
|
12
22
|
var ResetPasswordScreen = require('connection/database/reset_password').default;
|
|
13
23
|
return new ResetPasswordScreen();
|
|
14
24
|
};
|
|
15
25
|
|
|
26
|
+
var getComponent = function getComponent() {
|
|
27
|
+
var screen = getScreen();
|
|
28
|
+
return screen.render();
|
|
29
|
+
};
|
|
30
|
+
|
|
16
31
|
describe('ResetPasswordScreen', function () {
|
|
17
32
|
beforeEach(function () {
|
|
18
33
|
jest.resetModules();
|
|
@@ -35,9 +50,11 @@ describe('ResetPasswordScreen', function () {
|
|
|
35
50
|
});
|
|
36
51
|
|
|
37
52
|
jest.mock('i18n', function () {
|
|
38
|
-
return {
|
|
53
|
+
return {
|
|
54
|
+
str: function str(_, keys) {
|
|
39
55
|
return keys.join(',');
|
|
40
|
-
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
41
58
|
});
|
|
42
59
|
|
|
43
60
|
jest.mock('core/index', function () {
|
|
@@ -46,7 +63,16 @@ describe('ResetPasswordScreen', function () {
|
|
|
46
63
|
return 'id';
|
|
47
64
|
},
|
|
48
65
|
setGlobalError: 'setGlobalError',
|
|
49
|
-
clearGlobalError: 'clearGlobalError'
|
|
66
|
+
clearGlobalError: 'clearGlobalError',
|
|
67
|
+
connectionResolver: jest.fn().mockReturnValue(undefined),
|
|
68
|
+
ui: {
|
|
69
|
+
allowAutocomplete: function allowAutocomplete() {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
submitting: function submitting() {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
50
76
|
};
|
|
51
77
|
});
|
|
52
78
|
|
|
@@ -57,6 +83,7 @@ describe('ResetPasswordScreen', function () {
|
|
|
57
83
|
};
|
|
58
84
|
});
|
|
59
85
|
});
|
|
86
|
+
|
|
60
87
|
it('isSubmitDisabled returns true when `isEnterpriseDomain` is true', function () {
|
|
61
88
|
jest.useFakeTimers();
|
|
62
89
|
require('connection/enterprise').isEnterpriseDomain = function () {
|
|
@@ -67,6 +94,7 @@ describe('ResetPasswordScreen', function () {
|
|
|
67
94
|
jest.runTimersToTime(50);
|
|
68
95
|
expect(require('store/index').swap.mock.calls[0]).toMatchSnapshot();
|
|
69
96
|
});
|
|
97
|
+
|
|
70
98
|
it('isSubmitDisabled returns false when `isEnterpriseDomain` is false', function () {
|
|
71
99
|
require('connection/enterprise').isEnterpriseDomain = function () {
|
|
72
100
|
return false;
|
|
@@ -75,4 +103,54 @@ describe('ResetPasswordScreen', function () {
|
|
|
75
103
|
expect(screen.isSubmitDisabled()).toBe(false);
|
|
76
104
|
expect(require('store/index').swap.mock.calls[0]).toMatchSnapshot();
|
|
77
105
|
});
|
|
106
|
+
|
|
107
|
+
describe('a custom connection resolver is being used', function () {
|
|
108
|
+
var lock = void 0;
|
|
109
|
+
var i18n = void 0;
|
|
110
|
+
|
|
111
|
+
beforeEach(function () {
|
|
112
|
+
lock = _immutable2.default.fromJS({
|
|
113
|
+
id: '__lock-id__'
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
i18n = {
|
|
117
|
+
html: jest.fn(),
|
|
118
|
+
str: jest.fn()
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('copies the username to the email field if an email address was entered', function () {
|
|
123
|
+
require('core/index').connectionResolver.mockReturnValue(function () {
|
|
124
|
+
return function () {
|
|
125
|
+
return true;
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
var store = require('store/index');
|
|
129
|
+
var Component = getComponent();
|
|
130
|
+
|
|
131
|
+
// Set a field on Lock to set the username field, then check it was set as the email
|
|
132
|
+
var l = (0, _field.setField)(lock, 'username', 'test@test.com');
|
|
133
|
+
|
|
134
|
+
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, { i18n: i18n, model: l })).toMatchSnapshot();
|
|
135
|
+
|
|
136
|
+
expect(store.swap).toHaveBeenCalledWith('updateEntity', 'lock', 'id', expect.anything(), 'test@test.com', false);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('sets the email field to a blank value if username is not an email address', function () {
|
|
140
|
+
require('core/index').connectionResolver.mockReturnValue(function () {
|
|
141
|
+
return function () {
|
|
142
|
+
return true;
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
var store = require('store/index');
|
|
146
|
+
var Component = getComponent();
|
|
147
|
+
|
|
148
|
+
// Set a field on Lock to set the username field, then check it was set as the email
|
|
149
|
+
var l = (0, _field.setField)(lock, 'username', 'some-username');
|
|
150
|
+
|
|
151
|
+
(0, _testUtils.expectComponent)(_react2.default.createElement(Component, { i18n: i18n, model: l })).toMatchSnapshot();
|
|
152
|
+
|
|
153
|
+
expect(store.swap).toHaveBeenCalledWith('updateEntity', 'lock', 'id', expect.anything(), '', false);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
78
156
|
});
|
|
@@ -10,8 +10,6 @@ var _immutable = require('immutable');
|
|
|
10
10
|
|
|
11
11
|
var _immutable2 = _interopRequireDefault(_immutable);
|
|
12
12
|
|
|
13
|
-
var _reactTestRenderer = require('react-test-renderer');
|
|
14
|
-
|
|
15
13
|
var _testUtils = require('testUtils');
|
|
16
14
|
|
|
17
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -44,7 +42,10 @@ jest.mock('core/index', function () {
|
|
|
44
42
|
return {
|
|
45
43
|
handleEvent: jest.fn(function (_, event, fn) {
|
|
46
44
|
mockEventRegister[event] = fn;
|
|
47
|
-
})
|
|
45
|
+
}),
|
|
46
|
+
ui: {
|
|
47
|
+
forceAutoHeight: jest.fn().mockReturnValue(false)
|
|
48
|
+
}
|
|
48
49
|
};
|
|
49
50
|
});
|
|
50
51
|
|
|
@@ -113,4 +114,16 @@ describe('Chrome', function () {
|
|
|
113
114
|
|
|
114
115
|
(0, _testUtils.expectComponent)(_react2.default.createElement(Chrome, props)).toMatchSnapshot();
|
|
115
116
|
});
|
|
117
|
+
|
|
118
|
+
it('adds the auto-height class when forceAutoHeight UI prop is true', function () {
|
|
119
|
+
require('core/index').ui.forceAutoHeight.mockReturnValue(true);
|
|
120
|
+
|
|
121
|
+
var props = _extends({}, defaultProps, {
|
|
122
|
+
info: 'This is an information message',
|
|
123
|
+
success: 'This is a success message',
|
|
124
|
+
error: 'There is an error'
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
(0, _testUtils.expectComponent)(_react2.default.createElement(Chrome, props)).toMatchSnapshot();
|
|
128
|
+
});
|
|
116
129
|
});
|
|
@@ -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'),
|
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
|
|