auth0-lock 12.0.2 → 12.2.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/.eslintrc.json +1 -1
- package/.github/ISSUE_TEMPLATE/Bug Report.yml +79 -0
- package/.github/ISSUE_TEMPLATE/config.yml +2 -2
- package/.github/dependabot.yml +2 -5
- package/.github/workflows/codeql.yml +25 -12
- package/.github/workflows/publish.yml +74 -0
- package/.github/workflows/semgrep.yml +33 -9
- package/.github/workflows/snyk.yml +47 -0
- package/.github/workflows/test.yml +66 -0
- package/.semgrepignore +8 -0
- package/.shiprc +1 -1
- package/CHANGELOG.md +15 -0
- package/DEVELOPMENT.md +9 -10
- package/EXAMPLES.md +18 -5
- package/README.md +2 -3
- package/lib/__tests__/connection/database/login_pane.js +1 -1
- package/lib/__tests__/connection/database/password_reset_confirmation.js +1 -1
- package/lib/__tests__/connection/database/signed_up_confirmation.js +1 -1
- package/lib/__tests__/connection/enterprise/actions.js +2 -2
- package/lib/__tests__/connection/enterprise/quick_auth_screen.js +1 -1
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +1 -1
- package/lib/__tests__/core/signed_in_confirmation.js +1 -1
- package/lib/__tests__/field/captcha/friendlyCaptcha.js +58 -0
- package/lib/__tests__/field/captcha/hcaptcha.js +58 -0
- package/lib/__tests__/field/captcha/recaptcha_enterprise.js +3 -3
- package/lib/__tests__/field/captcha/recaptchav2.js +3 -3
- package/lib/__tests__/field/captcha.js +51 -7
- package/lib/__tests__/field/custom_input.js +21 -0
- package/lib/__tests__/testUtils.js +1 -1
- package/lib/__tests__/ui/box/confirmation_pane.js +1 -1
- package/lib/browser.js +9 -0
- package/lib/connection/captcha.js +1 -1
- package/lib/connection/enterprise/actions.js +6 -1
- package/lib/connection/passwordless/actions.js +1 -1
- package/lib/core/client/index.js +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/web_api/helper.js +1 -1
- package/lib/core.js +1 -1
- package/lib/field/captcha/captcha_pane.js +4 -4
- package/lib/field/captcha/{recaptcha.js → third_party_captcha.js} +74 -33
- package/lib/field/custom_input.js +1 -0
- package/lib/field/phone-number/phone_number_pane.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/header.js +6 -1
- package/lib/ui/input/checkbox_input.js +15 -4
- package/lib/ui/input/input_wrap.js +5 -1
- package/package.json +10 -14
- package/.circleci/config.yml +0 -92
- package/.github/ISSUE_TEMPLATE/report_a_bug.md +0 -57
- package/.snyk +0 -19
- package/Makefile +0 -22
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
var _enzyme = require("enzyme");
|
|
5
5
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
6
|
-
var
|
|
6
|
+
var _third_party_captcha = require("../../../field/captcha/third_party_captcha");
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
8
|
var createLockMock = function createLockMock() {
|
|
9
9
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
@@ -32,7 +32,7 @@ describe('Recaptcha v2', function () {
|
|
|
32
32
|
provider: 'recaptcha_v2',
|
|
33
33
|
sitekey: 'mySiteKey'
|
|
34
34
|
});
|
|
35
|
-
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(
|
|
35
|
+
var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
|
|
36
36
|
provider: 'recaptcha_v2',
|
|
37
37
|
lock: mockLock,
|
|
38
38
|
sitekey: 'mySiteKey'
|
|
@@ -47,7 +47,7 @@ describe('Recaptcha v2', function () {
|
|
|
47
47
|
document.getElementById('renderTest').remove();
|
|
48
48
|
});
|
|
49
49
|
it('injects the script', function () {
|
|
50
|
-
|
|
50
|
+
_third_party_captcha.ThirdPartyCaptcha.loadScript({
|
|
51
51
|
hl: 'en-US',
|
|
52
52
|
provider: 'recaptcha_v2'
|
|
53
53
|
}, document.body);
|
|
@@ -4,7 +4,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
4
4
|
var _enzyme = require("enzyme");
|
|
5
5
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
6
6
|
var _captcha_pane = _interopRequireDefault(require("../../field/captcha/captcha_pane"));
|
|
7
|
-
var
|
|
7
|
+
var _third_party_captcha = require("../../field/captcha/third_party_captcha");
|
|
8
8
|
var _captcha_input = _interopRequireDefault(require("../../ui/input/captcha_input"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
var createLockMock = function createLockMock() {
|
|
@@ -63,11 +63,55 @@ describe('CaptchaPane', function () {
|
|
|
63
63
|
i18n: i8nMock
|
|
64
64
|
}));
|
|
65
65
|
});
|
|
66
|
-
it('should render
|
|
67
|
-
expect(wrapper.find(
|
|
66
|
+
it('should render ThirdPartyCaptcha if provider is recaptchav2', function () {
|
|
67
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha)).toHaveLength(1);
|
|
68
68
|
});
|
|
69
69
|
it('should pass the sitekey', function () {
|
|
70
|
-
expect(wrapper.find(
|
|
70
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha).props().sitekey).toBe('mySiteKey');
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe('friendly captcha', function () {
|
|
74
|
+
var wrapper;
|
|
75
|
+
beforeAll(function () {
|
|
76
|
+
var lockMock = createLockMock({
|
|
77
|
+
provider: 'friendly_captcha',
|
|
78
|
+
siteKey: 'mySiteKey'
|
|
79
|
+
});
|
|
80
|
+
var i8nMock = createI18nMock();
|
|
81
|
+
var onReloadMock = jest.fn();
|
|
82
|
+
wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
83
|
+
lock: lockMock,
|
|
84
|
+
onReload: onReloadMock,
|
|
85
|
+
i18n: i8nMock
|
|
86
|
+
}));
|
|
87
|
+
});
|
|
88
|
+
it('should render ThirdPartyCaptcha if provider is friendly captcha', function () {
|
|
89
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha)).toHaveLength(1);
|
|
90
|
+
});
|
|
91
|
+
it('should pass the sitekey', function () {
|
|
92
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha).props().sitekey).toBe('mySiteKey');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe('hcaptcha', function () {
|
|
96
|
+
var wrapper;
|
|
97
|
+
beforeAll(function () {
|
|
98
|
+
var lockMock = createLockMock({
|
|
99
|
+
provider: 'hcaptcha',
|
|
100
|
+
siteKey: 'mySiteKey'
|
|
101
|
+
});
|
|
102
|
+
var i8nMock = createI18nMock();
|
|
103
|
+
var onReloadMock = jest.fn();
|
|
104
|
+
wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
105
|
+
lock: lockMock,
|
|
106
|
+
onReload: onReloadMock,
|
|
107
|
+
i18n: i8nMock
|
|
108
|
+
}));
|
|
109
|
+
});
|
|
110
|
+
it('should render ThirdPartyCaptcha if provider is hCaptcha', function () {
|
|
111
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha)).toHaveLength(1);
|
|
112
|
+
});
|
|
113
|
+
it('should pass the sitekey', function () {
|
|
114
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha).props().sitekey).toBe('mySiteKey');
|
|
71
115
|
});
|
|
72
116
|
});
|
|
73
117
|
describe('recaptcha enterprise', function () {
|
|
@@ -85,11 +129,11 @@ describe('CaptchaPane', function () {
|
|
|
85
129
|
i18n: i8nMock
|
|
86
130
|
}));
|
|
87
131
|
});
|
|
88
|
-
it('should render
|
|
89
|
-
expect(wrapper.find(
|
|
132
|
+
it('should render ThirdPartyCaptcha if provider is recaptcha_enterprise', function () {
|
|
133
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha)).toHaveLength(1);
|
|
90
134
|
});
|
|
91
135
|
it('should pass the sitekey', function () {
|
|
92
|
-
expect(wrapper.find(
|
|
136
|
+
expect(wrapper.find(_third_party_captcha.ThirdPartyCaptcha).props().sitekey).toBe('mySiteKey');
|
|
93
137
|
});
|
|
94
138
|
});
|
|
95
139
|
});
|
|
@@ -118,17 +118,38 @@ describe('CustomInput', function () {
|
|
|
118
118
|
return defaultProps.type = 'checkbox';
|
|
119
119
|
});
|
|
120
120
|
it('renders correctly as a CheckBoxInput', function () {
|
|
121
|
+
require('field/index').isFieldVisiblyInvalid = function () {
|
|
122
|
+
return false;
|
|
123
|
+
};
|
|
121
124
|
var CustomInput = getComponent();
|
|
122
125
|
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(CustomInput, defaultProps)).toMatchSnapshot();
|
|
123
126
|
});
|
|
124
127
|
describe('and when placeholderHTML is set', function () {
|
|
125
128
|
it('renders correctly as a CheckBoxInput', function () {
|
|
129
|
+
require('field/index').isFieldVisiblyInvalid = function () {
|
|
130
|
+
return false;
|
|
131
|
+
};
|
|
126
132
|
var CustomInput = getComponent();
|
|
127
133
|
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(CustomInput, _extends({}, defaultProps, {
|
|
128
134
|
placeholderHTML: '<b>Placeholder</b>'
|
|
129
135
|
}))).toMatchSnapshot();
|
|
130
136
|
});
|
|
131
137
|
});
|
|
138
|
+
it('shows an error when value is incorrect', function () {
|
|
139
|
+
var CustomInput = getComponent();
|
|
140
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(CustomInput, _extends({}, defaultProps, {
|
|
141
|
+
placeholderHTML: '<b>Placeholder</b>'
|
|
142
|
+
}))).toMatchSnapshot();
|
|
143
|
+
});
|
|
144
|
+
it('highlights placeholder text when no invalid hint is provided', function () {
|
|
145
|
+
require('field/index').getFieldInvalidHint = function () {
|
|
146
|
+
return undefined;
|
|
147
|
+
};
|
|
148
|
+
var CustomInput = getComponent();
|
|
149
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(CustomInput, _extends({}, defaultProps, {
|
|
150
|
+
placeholderHTML: '<b>Placeholder</b>'
|
|
151
|
+
}))).toMatchSnapshot();
|
|
152
|
+
});
|
|
132
153
|
});
|
|
133
154
|
describe('when type == hidden', function () {
|
|
134
155
|
beforeEach(function () {
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _reactTestRenderer = _interopRequireDefault(require("react-test-renderer"));
|
|
10
10
|
var _shallow = _interopRequireDefault(require("react-test-renderer/shallow"));
|
|
11
11
|
var _webpack = require("webpack");
|
|
12
|
-
var _excluded = ["children"];
|
|
12
|
+
var _excluded = ["children"]; // eslint-disable-line
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
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; }
|
|
15
15
|
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; }
|
|
@@ -6,7 +6,7 @@ var _immutable = _interopRequireDefault(require("immutable"));
|
|
|
6
6
|
var _testUtils = require("testUtils");
|
|
7
7
|
var _confirmation_pane = _interopRequireDefault(require("../../../ui/box/confirmation_pane"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
9
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || "" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
10
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
11
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
12
|
var defaultProps = {
|
package/lib/browser.js
CHANGED
|
@@ -368,6 +368,15 @@ require("core-js/modules/web.url-search-params.js");
|
|
|
368
368
|
var _index = _interopRequireDefault(require("./index"));
|
|
369
369
|
var _passwordless = _interopRequireDefault(require("./passwordless"));
|
|
370
370
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
371
|
+
/*
|
|
372
|
+
*
|
|
373
|
+
* This is used to build the bundle with browserify.
|
|
374
|
+
*
|
|
375
|
+
* The bundle is used by people who doesn't use browserify.
|
|
376
|
+
* Those who use browserify will install with npm and require the module,
|
|
377
|
+
* the package.json file points to index.js.
|
|
378
|
+
*/
|
|
379
|
+
|
|
371
380
|
if (typeof window !== 'undefined') {
|
|
372
381
|
if (typeof window.define == 'function' && window.define.amd) {
|
|
373
382
|
window.define('auth0Lock', function () {
|
|
@@ -25,7 +25,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
25
25
|
function showMissingCaptcha(m, id) {
|
|
26
26
|
var isPasswordless = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
27
27
|
var captchaConfig = isPasswordless ? l.passwordlessCaptcha(m) : l.captcha(m);
|
|
28
|
-
var captchaError = captchaConfig.get('provider') === 'recaptcha_v2' || captchaConfig.get('provider') === 'recaptcha_enterprise' ? 'invalid_recaptcha' : 'invalid_captcha';
|
|
28
|
+
var captchaError = captchaConfig.get('provider') === 'recaptcha_v2' || captchaConfig.get('provider') === 'recaptcha_enterprise' || captchaConfig.get('provider') === 'hcaptcha' || captchaConfig.get('provider') === 'friendly_captcha' ? 'invalid_recaptcha' : 'invalid_captcha';
|
|
29
29
|
var errorMessage = i18n.html(m, ['error', 'login', captchaError]);
|
|
30
30
|
(0, _index3.swap)(_index3.updateEntity, 'lock', id, function (m) {
|
|
31
31
|
m = l.setSubmitting(m, false, errorMessage);
|
|
@@ -21,7 +21,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
21
21
|
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; }
|
|
22
22
|
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; }
|
|
23
23
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
-
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); }
|
|
24
|
+
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); } // TODO: enterprise connections should not depend on database
|
|
25
|
+
// connections. However, we now allow a username input to contain also
|
|
26
|
+
// an email and this information is in the database module. We should
|
|
27
|
+
// make this information flow from the UI (like we do for the startHRD
|
|
28
|
+
// function). Including this dependency here allows us to do that
|
|
29
|
+
// incrementally.
|
|
25
30
|
function startHRD(id, email) {
|
|
26
31
|
(0, _index.swap)(_index.updateEntity, 'lock', id, _enterprise.toggleHRD, email);
|
|
27
32
|
}
|
|
@@ -36,7 +36,7 @@ function getErrorMessage(m, id, error) {
|
|
|
36
36
|
}
|
|
37
37
|
if (error.code === 'invalid_captcha') {
|
|
38
38
|
var captchaConfig = l.passwordlessCaptcha(m);
|
|
39
|
-
key = captchaConfig.get('provider') === 'recaptcha_v2' || captchaConfig.get('provider') === 'recaptcha_enterprise' ? 'invalid_recaptcha' : 'invalid_captcha';
|
|
39
|
+
key = captchaConfig.get('provider') === 'recaptcha_v2' || captchaConfig.get('provider') === 'recaptcha_enterprise' || captchaConfig.get('provider') === 'hcaptcha' || captchaConfig.get('provider') === 'friendly_captcha' ? 'invalid_recaptcha' : 'invalid_captcha';
|
|
40
40
|
}
|
|
41
41
|
return i18n.html(m, ['error', 'passwordless', key]) || i18n.html(m, ['error', 'passwordless', 'lock.fallback']);
|
|
42
42
|
}
|
package/lib/core/client/index.js
CHANGED
|
@@ -26,7 +26,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
26
26
|
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; }
|
|
27
27
|
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; }
|
|
28
28
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
29
|
-
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); }
|
|
29
|
+
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); } // TODO: this module should depend from social stuff
|
|
30
30
|
var _dataFns = (0, _data_utils.dataFns)(['client']),
|
|
31
31
|
initNS = _dataFns.initNS,
|
|
32
32
|
get = _dataFns.get;
|
package/lib/core/index.js
CHANGED
|
@@ -655,7 +655,7 @@ function loginErrorMessage(m, error, type) {
|
|
|
655
655
|
}
|
|
656
656
|
if (code === 'invalid_captcha') {
|
|
657
657
|
var currentCaptcha = get(m, 'captcha');
|
|
658
|
-
if (currentCaptcha && (currentCaptcha.get('provider') === 'recaptcha_v2' || currentCaptcha.get('provider') === 'recaptcha_enterprise')) {
|
|
658
|
+
if (currentCaptcha && (currentCaptcha.get('provider') === 'recaptcha_v2' || currentCaptcha.get('provider') === 'recaptcha_enterprise' || currentCaptcha.get('provider') === 'hcaptcha' || captchaConfig.get('provider') === 'friendly_captcha')) {
|
|
659
659
|
code = 'invalid_recaptcha';
|
|
660
660
|
}
|
|
661
661
|
}
|