@reachfive/identity-ui 1.14.0 → 1.16.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/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.16.1] - 2022-07-29
11
+
12
+ ### Fixes
13
+
14
+ Fix code validation in passwordless widget.
15
+
16
+ ## [1.16.0] - 2022-07-27
17
+
18
+ ### Changed
19
+
20
+ Upgrade identity-web-core-sdk version to 1.24.0
21
+
22
+ ### Fixes
23
+
24
+ Fix consents UI in profile editor component.
25
+
26
+ ## [1.15.0] - 2022-02-22
27
+
28
+ ### Added
29
+
30
+ - Add ReCaptcha V3 for authentication pages: forgot-password, signup, login-with-password
31
+ - Add ReCaptcha V3 for passwordless page
32
+
10
33
  ## [1.14.0] - 2021-11-10
11
34
 
12
35
  ### Changed
@@ -76,7 +99,7 @@ Temporary revert the SDK Core dependency version to solve the login with PKCE in
76
99
 
77
100
  ## [1.11.2] - 2020-11-04
78
101
 
79
- ### Features
102
+ ### Added
80
103
 
81
104
  A new check rule for password strength is now displayed on the signup view on
82
105
  the [showAuth](https://developer.reachfive.com/sdk-ui/showAuth.html) widget.
@@ -89,7 +112,7 @@ Revert the new check rule for password strength since the wordings are not yet d
89
112
 
90
113
  ## [1.11.0] - 2020-10-28
91
114
 
92
- ### Features
115
+ ### Added
93
116
 
94
117
  New changes were made on the [showAuth](https://developer.reachfive.com/sdk-ui/showAuth.html) widget:
95
118
 
@@ -106,14 +129,14 @@ Revert the latest FIDO2 signup Features since it's breaking the style of Hosted
106
129
 
107
130
  ## [1.10.0] - 2020-10-16
108
131
 
109
- ### Features
132
+ ### Added
110
133
 
111
134
  The [showAuth](https://developer.reachfive.com/sdk-ui/showAuth.html) widget can now handle signup with biometrics if
112
135
  the `allowWebAuthnSignup` option is enabled.
113
136
 
114
137
  ## [1.9.0] - 2020-09-16
115
138
 
116
- ### Features
139
+ ### Added
117
140
 
118
141
  Always override account `opt-out` consents.
119
142
 
@@ -123,13 +146,13 @@ Fixes the CircleCi job to deploy a new version.
123
146
 
124
147
  ## [1.8.0] - 2020-07-22
125
148
 
126
- ### Features
149
+ ### Added
127
150
 
128
151
  Add custom fields types (email & phone).
129
152
 
130
153
  ## [1.7.0] - 2020-07-08
131
154
 
132
- ### Features
155
+ ### Added
133
156
 
134
157
  - The user can now set the device's name in
135
158
  the [showWebAuthnDevices](https://developer.reachfive.com/sdk-ui/showWebAuthnDevices.html) widget.
@@ -137,7 +160,7 @@ Add custom fields types (email & phone).
137
160
 
138
161
  ## [1.6.0] - 2020-07-07
139
162
 
140
- ### Features
163
+ ### Added
141
164
 
142
165
  Display a friendly user error message on
143
166
  the [showWebAuthnDevices](https://developer.reachfive.com/sdk-ui/showWebAuthnDevices.html) widget when the user wants to
@@ -145,7 +168,7 @@ add a device already registered.
145
168
 
146
169
  ## [1.5.0] - 2020-07-01
147
170
 
148
- ### Features
171
+ ### Added
149
172
 
150
173
  Add a new widget [showWebAuthnDevices](https://developer.reachfive.com/sdk-ui/showWebAuthnDevices.html) allowing the
151
174
  management of the user’s registered FIDO2 devices.
@@ -158,7 +181,7 @@ The UI SDK now uses the latest version of the Core SDK.
158
181
 
159
182
  ## [1.4.0] - 2020-06-15
160
183
 
161
- ### Features
184
+ ### Added
162
185
 
163
186
  Add a new `allowWebAuthnLogin` option to the [showAuth](https://developer.reachfive.com/sdk-ui/showAuth.html) widget to
164
187
  allow a user to login with biometrics.
@@ -169,7 +192,7 @@ allow a user to login with biometrics.
169
192
 
170
193
  Call only the validation methods when the field is required or when the value is not empty.
171
194
 
172
- ### Features
195
+ ### Added
173
196
 
174
197
  - Set the default value of the _Remember be_ to `false`.
175
198
  - Upgrade all the dependencies.
@@ -200,13 +223,13 @@ ReachFive UI SDK is out! 🚀
200
223
 
201
224
  ## [1.0.0-alpha.10] - 2020-02-19
202
225
 
203
- ### Features
226
+ ### Added
204
227
 
205
228
  Improve the UX/UI of the password policy rules validation.
206
229
 
207
230
  ## [1.0.0-alpha.9] - 2020-02-10
208
231
 
209
- ### Features
232
+ ### Added
210
233
 
211
234
  The _display password in clear text_ option can now be enabled on the password reset widget.
212
235
 
@@ -218,7 +241,7 @@ The UI SDK uses now the latest version of the Core SDK.
218
241
 
219
242
  ## [1.0.0-alpha.7] - 2020-02-06
220
243
 
221
- ### Features
244
+ ### Added
222
245
 
223
246
  Add the `returnToAfterPasswordReset` parameter for reset password and the `returnToAfterEmailConfirmation` parameter for
224
247
  signup.
@@ -237,14 +260,14 @@ Passwords in the French dictionary were considered good enough while they weren'
237
260
 
238
261
  ## [1.0.0-alpha.4] - 2020-01-15
239
262
 
240
- ### Features
263
+ ### Added
241
264
 
242
265
  - French weak passwords are now rejected by the password strength policies.
243
266
  - A UMD bundle is now generated at the build process. It will allow deploying the UI SDK on [unpkg](https://unpkg.com).
244
267
 
245
268
  ## [1.0.0-alpha.3] - 2020-01-07
246
269
 
247
- ### Features
270
+ ### Added
248
271
 
249
272
  - Implement continuous integration pipelines set up with CircleCI (see
250
273
  the [CircleCI configuration file](.circleci/config.yml) for more details).
@@ -256,7 +279,7 @@ The eye icon is now correctly displayed in the Auth widget.
256
279
 
257
280
  ## [1.0.0-alpha.2] - 2019-11-06
258
281
 
259
- ### Features
282
+ ### Added
260
283
 
261
284
  - A `data-testid` attribute was added to most of the HTML elements.
262
285
  - Handle the errors returned at the creation of a password non-compliant to the account's password policy.
@@ -265,7 +288,23 @@ The eye icon is now correctly displayed in the Auth widget.
265
288
 
266
289
  First version of the SDK Web UI.
267
290
 
268
- [Unreleased]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.11.5...HEAD
291
+ [Unreleased]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.16.1...HEAD
292
+
293
+ [1.16.1]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.16.0...v1.16.1
294
+
295
+ [1.16.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.15.0...v1.16.0
296
+
297
+ [1.15.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.14.0...v1.15.0
298
+
299
+ [1.14.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.13.0...v1.14.0
300
+
301
+ [1.13.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.12.0...v1.13.0
302
+
303
+ [1.12.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.11.7...v1.12.0
304
+
305
+ [1.11.7]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.11.6...v1.11.7
306
+
307
+ [1.11.6]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.11.5...v1.11.6
269
308
 
270
309
  [1.11.5]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.11.4...v1.11.5
271
310
 
@@ -4079,11 +4079,12 @@ function multiViewWidget(_ref3) {
4079
4079
 
4080
4080
  /* Returns whether a form value has been set with a valid value.
4081
4081
  * If the user's input has been enriched as an object, raw input is expected
4082
- * to be in a `raw` field.
4082
+ * to be in a raw property field (named 'raw' by default).
4083
4083
  */
4084
4084
 
4085
4085
  function isValued(v) {
4086
- var unwrap = isObject(v) ? v.raw : v;
4086
+ var rawProperty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'raw';
4087
+ var unwrap = isObject(v) ? v[rawProperty] : v;
4087
4088
  return unwrap !== null && unwrap !== undefined && unwrap !== '' && !Number.isNaN(unwrap) && (Array.isArray(unwrap) ? unwrap.length > 0 : true);
4088
4089
  }
4089
4090
  function formatISO8601Date(year, month, day) {
@@ -8830,6 +8831,8 @@ var createField = function createField(_ref) {
8830
8831
  return !isEmpty(x) ? x : null;
8831
8832
  }
8832
8833
  } : _ref$format,
8834
+ _ref$rawProperty = _ref.rawProperty,
8835
+ rawProperty = _ref$rawProperty === void 0 ? 'raw' : _ref$rawProperty,
8833
8836
  component = _ref.component,
8834
8837
  _ref$extendedParams = _ref.extendedParams,
8835
8838
  extendedParams = _ref$extendedParams === void 0 ? {} : _ref$extendedParams;
@@ -8863,7 +8866,7 @@ var createField = function createField(_ref) {
8863
8866
  },
8864
8867
  initialize: function initialize(model) {
8865
8868
  var modelValue = mapping.bind(model);
8866
- var initValue = isValued(modelValue) ? modelValue : defaultValue;
8869
+ var initValue = isValued(modelValue, rawProperty) ? modelValue : defaultValue;
8867
8870
  return {
8868
8871
  value: format.bind(initValue),
8869
8872
  isDirty: false
@@ -9343,6 +9346,97 @@ function identifierField(props, config) {
9343
9346
  }));
9344
9347
  }
9345
9348
 
9349
+ var ReCaptcha = function ReCaptcha() {
9350
+ _classCallCheck(this, ReCaptcha);
9351
+ };
9352
+
9353
+ _defineProperty(ReCaptcha, "getRecaptchaToken", /*#__PURE__*/function () {
9354
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(siteKey, action) {
9355
+ return regeneratorRuntime.wrap(function _callee$(_context) {
9356
+ while (1) {
9357
+ switch (_context.prev = _context.next) {
9358
+ case 0:
9359
+ _context.next = 2;
9360
+ return window.grecaptcha.execute(siteKey, {
9361
+ action: action
9362
+ });
9363
+
9364
+ case 2:
9365
+ return _context.abrupt("return", _context.sent);
9366
+
9367
+ case 3:
9368
+ case "end":
9369
+ return _context.stop();
9370
+ }
9371
+ }
9372
+ }, _callee);
9373
+ }));
9374
+
9375
+ return function (_x, _x2) {
9376
+ return _ref.apply(this, arguments);
9377
+ };
9378
+ }());
9379
+
9380
+ _defineProperty(ReCaptcha, "handle", /*#__PURE__*/function () {
9381
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(data, conf, callback, action) {
9382
+ var captchaToken;
9383
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
9384
+ while (1) {
9385
+ switch (_context2.prev = _context2.next) {
9386
+ case 0:
9387
+ if (!conf.recaptcha_enabled) {
9388
+ _context2.next = 13;
9389
+ break;
9390
+ }
9391
+
9392
+ _context2.prev = 1;
9393
+ _context2.next = 4;
9394
+ return ReCaptcha.getRecaptchaToken(conf.recaptcha_site_key, action);
9395
+
9396
+ case 4:
9397
+ captchaToken = _context2.sent;
9398
+ return _context2.abrupt("return", callback(_objectSpread2(_objectSpread2({}, data), {}, {
9399
+ captchaToken: captchaToken
9400
+ })));
9401
+
9402
+ case 8:
9403
+ _context2.prev = 8;
9404
+ _context2.t0 = _context2["catch"](1);
9405
+ return _context2.abrupt("return", Promise.reject({
9406
+ errorUserMsg: "Error recaptcha",
9407
+ errorMessageKey: "recaptcha.error"
9408
+ }));
9409
+
9410
+ case 11:
9411
+ _context2.next = 14;
9412
+ break;
9413
+
9414
+ case 13:
9415
+ return _context2.abrupt("return", callback(data));
9416
+
9417
+ case 14:
9418
+ case "end":
9419
+ return _context2.stop();
9420
+ }
9421
+ }
9422
+ }, _callee2, null, [[1, 8]]);
9423
+ }));
9424
+
9425
+ return function (_x3, _x4, _x5, _x6) {
9426
+ return _ref2.apply(this, arguments);
9427
+ };
9428
+ }());
9429
+ function importGoogleRecaptchaScript(site_key) {
9430
+ var script = document.createElement("script");
9431
+ script.src = "https://www.google.com/recaptcha/api.js?render=" + site_key;
9432
+ document.body.appendChild(script);
9433
+ }
9434
+ function extractCaptchaTokenFromData(data) {
9435
+ var token = data.captchaToken;
9436
+ delete data.captchaToken;
9437
+ return token;
9438
+ }
9439
+
9346
9440
  function _templateObject$7() {
9347
9441
  var data = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n text-align: right;\n ", ";\n"]);
9348
9442
 
@@ -9414,9 +9508,10 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
9414
9508
 
9415
9509
  _this = _super.call.apply(_super, [this].concat(args));
9416
9510
 
9417
- _defineProperty(_assertThisInitialized(_this), "handleLogin", function (data) {
9511
+ _defineProperty(_assertThisInitialized(_this), "callback", function (data) {
9418
9512
  var specializedData = specializeIdentifierData(data);
9419
9513
  return _this.props.apiClient.loginWithPassword(_objectSpread2(_objectSpread2({}, specializedData), {}, {
9514
+ captchaToken: data.captchaToken,
9420
9515
  auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
9421
9516
  }));
9422
9517
  });
@@ -9425,8 +9520,15 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
9425
9520
  }
9426
9521
 
9427
9522
  _createClass(LoginView, [{
9523
+ key: "componentDidMount",
9524
+ value: function componentDidMount() {
9525
+ importGoogleRecaptchaScript(this.props.recaptcha_site_key);
9526
+ }
9527
+ }, {
9428
9528
  key: "render",
9429
9529
  value: function render() {
9530
+ var _this2 = this;
9531
+
9430
9532
  var _this$props = this.props,
9431
9533
  socialProviders = _this$props.socialProviders,
9432
9534
  _this$props$session = _this$props.session,
@@ -9445,7 +9547,9 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
9445
9547
  showForgotPassword: this.props.allowForgotPassword,
9446
9548
  canShowPassword: this.props.canShowPassword,
9447
9549
  defaultIdentifier: defaultIdentifier,
9448
- handler: this.handleLogin,
9550
+ handler: function handler(data) {
9551
+ return ReCaptcha.handle(data, _this2.props, _this2.callback, "login");
9552
+ },
9449
9553
  config: this.props.config
9450
9554
  }), this.props.allowSignup && /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement("span", null, i18n('login.signupLinkPrefix')), "\xA0", /*#__PURE__*/React__default.createElement(Link, {
9451
9555
  target: "signup"
@@ -9791,9 +9895,10 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
9791
9895
 
9792
9896
  _this = _super.call.apply(_super, [this].concat(args));
9793
9897
 
9794
- _defineProperty(_assertThisInitialized(_this), "handleLogin", function (data) {
9898
+ _defineProperty(_assertThisInitialized(_this), "callback", function (data) {
9795
9899
  var specializedData = specializeIdentifierData(data);
9796
9900
  return _this.props.apiClient.loginWithPassword(_objectSpread2(_objectSpread2({}, specializedData), {}, {
9901
+ captchaToken: data.captchaToken,
9797
9902
  auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
9798
9903
  }));
9799
9904
  });
@@ -9802,8 +9907,15 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
9802
9907
  }
9803
9908
 
9804
9909
  _createClass(LoginView, [{
9910
+ key: "componentDidMount",
9911
+ value: function componentDidMount() {
9912
+ importGoogleRecaptchaScript(this.props.recaptcha_site_key);
9913
+ }
9914
+ }, {
9805
9915
  key: "render",
9806
9916
  value: function render() {
9917
+ var _this2 = this;
9918
+
9807
9919
  var i18n = this.props.i18n;
9808
9920
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), /*#__PURE__*/React__default.createElement(LoginWithPasswordForm, {
9809
9921
  username: this.props.username,
@@ -9811,7 +9923,9 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
9811
9923
  showRememberMe: this.props.showRememberMe,
9812
9924
  showForgotPassword: this.props.allowForgotPassword,
9813
9925
  canShowPassword: this.props.canShowPassword,
9814
- handler: this.handleLogin,
9926
+ handler: function handler(data) {
9927
+ return ReCaptcha.handle(data, _this2.props, _this2.callback, "login");
9928
+ },
9815
9929
  config: this.props.config
9816
9930
  }), /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement(Link, {
9817
9931
  target: "login-with-web-authn"
@@ -11021,6 +11135,7 @@ function consentField(config) {
11021
11135
  }
11022
11136
  },
11023
11137
  validator: config.required ? checked : empty,
11138
+ rawProperty: 'granted',
11024
11139
  component: ConsentField
11025
11140
  }));
11026
11141
  }
@@ -11308,8 +11423,10 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
11308
11423
  blacklist: []
11309
11424
  });
11310
11425
 
11311
- _defineProperty(_assertThisInitialized(_this), "handleSignup", function (data) {
11426
+ _defineProperty(_assertThisInitialized(_this), "callback", function (data) {
11427
+ var captchaToken = extractCaptchaTokenFromData(data);
11312
11428
  return _this.props.apiClient.signup({
11429
+ captchaToken: captchaToken,
11313
11430
  data: snakeCaseProperties(data),
11314
11431
  auth: _this.props.auth,
11315
11432
  redirectUrl: _this.props && _this.props.redirectUrl,
@@ -11339,8 +11456,15 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
11339
11456
  }
11340
11457
 
11341
11458
  _createClass(PasswordSignupForm, [{
11459
+ key: "componentDidMount",
11460
+ value: function componentDidMount() {
11461
+ importGoogleRecaptchaScript(this.props.recaptcha_site_key);
11462
+ }
11463
+ }, {
11342
11464
  key: "render",
11343
11465
  value: function render() {
11466
+ var _this2 = this;
11467
+
11344
11468
  var _this$props = this.props,
11345
11469
  _this$props$beforeSig = _this$props.beforeSignup,
11346
11470
  beforeSignup = _this$props$beforeSig === void 0 ? function (x) {
@@ -11371,7 +11495,9 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
11371
11495
  beforeSubmit: beforeSignup,
11372
11496
  onFieldChange: this.refreshBlacklist,
11373
11497
  sharedProps: sharedProps,
11374
- handler: this.handleSignup
11498
+ handler: function handler(data) {
11499
+ return ReCaptcha.handle(data, _this2.props, _this2.callback, "signup");
11500
+ }
11375
11501
  });
11376
11502
  }
11377
11503
  }]);
@@ -11529,10 +11655,29 @@ var skipError = function skipError(err) {
11529
11655
  };
11530
11656
 
11531
11657
  var enhance = recompose.withHandlers({
11532
- handleSubmit: function handleSubmit(_ref) {
11658
+ callback: function callback(_ref) {
11533
11659
  var apiClient = _ref.apiClient,
11534
11660
  redirectUrl = _ref.redirectUrl,
11535
- returnToAfterPasswordReset = _ref.returnToAfterPasswordReset;
11661
+ returnToAfterPasswordReset = _ref.returnToAfterPasswordReset,
11662
+ recaptcha_enabled = _ref.recaptcha_enabled,
11663
+ recaptcha_site_key = _ref.recaptcha_site_key;
11664
+ return function (data) {
11665
+ return ReCaptcha.handle(_objectSpread2(_objectSpread2({}, data), {}, {
11666
+ redirectUrl: redirectUrl,
11667
+ returnToAfterPasswordReset: returnToAfterPasswordReset
11668
+ }), {
11669
+ apiClient: apiClient,
11670
+ redirectUrl: redirectUrl,
11671
+ returnToAfterPasswordReset: returnToAfterPasswordReset,
11672
+ recaptcha_enabled: recaptcha_enabled,
11673
+ recaptcha_site_key: recaptcha_site_key
11674
+ }, apiClient.requestPasswordReset, "forgot_password");
11675
+ };
11676
+ },
11677
+ handleSubmit: function handleSubmit(_ref2) {
11678
+ var apiClient = _ref2.apiClient,
11679
+ redirectUrl = _ref2.redirectUrl,
11680
+ returnToAfterPasswordReset = _ref2.returnToAfterPasswordReset;
11536
11681
  return function (data) {
11537
11682
  return apiClient.requestPasswordReset(_objectSpread2(_objectSpread2({}, data), {}, {
11538
11683
  redirectUrl: redirectUrl,
@@ -11541,17 +11686,18 @@ var enhance = recompose.withHandlers({
11541
11686
  };
11542
11687
  }
11543
11688
  });
11544
- var ForgotPasswordView = enhance(function (_ref2) {
11545
- var i18n = _ref2.i18n,
11546
- goTo = _ref2.goTo,
11547
- allowLogin = _ref2.allowLogin,
11548
- handleSubmit = _ref2.handleSubmit,
11549
- displaySafeErrorMessage = _ref2.displaySafeErrorMessage,
11550
- showLabels = _ref2.showLabels,
11551
- allowWebAuthnLogin = _ref2.allowWebAuthnLogin;
11552
- return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('forgotPassword.title')), /*#__PURE__*/React__default.createElement(Intro, null, i18n('forgotPassword.prompt')), /*#__PURE__*/React__default.createElement(ForgotPasswordForm, {
11689
+ var ForgotPasswordView = enhance(function (_ref3) {
11690
+ var i18n = _ref3.i18n,
11691
+ goTo = _ref3.goTo,
11692
+ allowLogin = _ref3.allowLogin,
11693
+ callback = _ref3.callback,
11694
+ displaySafeErrorMessage = _ref3.displaySafeErrorMessage,
11695
+ showLabels = _ref3.showLabels,
11696
+ allowWebAuthnLogin = _ref3.allowWebAuthnLogin,
11697
+ recaptcha_site_key = _ref3.recaptcha_site_key;
11698
+ return /*#__PURE__*/React__default.createElement("div", null, importGoogleRecaptchaScript(recaptcha_site_key), /*#__PURE__*/React__default.createElement(Heading, null, i18n('forgotPassword.title')), /*#__PURE__*/React__default.createElement(Intro, null, i18n('forgotPassword.prompt')), /*#__PURE__*/React__default.createElement(ForgotPasswordForm, {
11553
11699
  showLabels: showLabels,
11554
- handler: handleSubmit,
11700
+ handler: callback,
11555
11701
  onSuccess: function onSuccess() {
11556
11702
  return goTo('forgot-password-success');
11557
11703
  },
@@ -11560,10 +11706,10 @@ var ForgotPasswordView = enhance(function (_ref2) {
11560
11706
  target: allowWebAuthnLogin ? 'login-with-web-authn' : 'login'
11561
11707
  }, i18n('forgotPassword.backToLoginLink'))));
11562
11708
  });
11563
- var ForgotPasswordSuccessView = function ForgotPasswordSuccessView(_ref3) {
11564
- var i18n = _ref3.i18n,
11565
- allowLogin = _ref3.allowLogin,
11566
- allowWebAuthnLogin = _ref3.allowWebAuthnLogin;
11709
+ var ForgotPasswordSuccessView = function ForgotPasswordSuccessView(_ref4) {
11710
+ var i18n = _ref4.i18n,
11711
+ allowLogin = _ref4.allowLogin,
11712
+ allowWebAuthnLogin = _ref4.allowWebAuthnLogin;
11567
11713
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('forgotPassword.title')), /*#__PURE__*/React__default.createElement(Info, null, i18n('forgotPassword.successMessage')), allowLogin && /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement(Link, {
11568
11714
  target: allowWebAuthnLogin ? 'login-with-web-authn' : 'login'
11569
11715
  }, i18n('back'))));
@@ -12379,7 +12525,7 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
12379
12525
 
12380
12526
  _this = _super.call.apply(_super, [this].concat(args));
12381
12527
 
12382
- _defineProperty(_assertThisInitialized(_this), "handleSubmit", function (data) {
12528
+ _defineProperty(_assertThisInitialized(_this), "callback", function (data) {
12383
12529
  return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function (_) {
12384
12530
  return data;
12385
12531
  });
@@ -12393,8 +12539,15 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
12393
12539
  }
12394
12540
 
12395
12541
  _createClass(MainView, [{
12542
+ key: "componentDidMount",
12543
+ value: function componentDidMount() {
12544
+ importGoogleRecaptchaScript(this.props.recaptcha_site_key);
12545
+ }
12546
+ }, {
12396
12547
  key: "render",
12397
12548
  value: function render() {
12549
+ var _this2 = this;
12550
+
12398
12551
  var _this$props = this.props,
12399
12552
  i18n = _this$props.i18n,
12400
12553
  showSocialLogins = _this$props.showSocialLogins,
@@ -12409,10 +12562,14 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
12409
12562
  }), showSocialLogins && socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(Separator, {
12410
12563
  text: i18n('or')
12411
12564
  }), isEmail && showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('passwordless.intro')), isEmail && /*#__PURE__*/React__default.createElement(EmailInputForm, {
12412
- handler: this.handleSubmit,
12565
+ handler: function handler(data) {
12566
+ return ReCaptcha.handle(data, _this2.props, _this2.callback, "passwordless_email");
12567
+ },
12413
12568
  onSuccess: this.handleSuccess
12414
12569
  }), !isEmail && showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('passwordless.sms.intro')), !isEmail && /*#__PURE__*/React__default.createElement(PhoneNumberInputForm, {
12415
- handler: this.handleSubmit,
12570
+ handler: function handler(data) {
12571
+ return ReCaptcha.handle(data, _this2.props, _this2.callback, "passwordless_phone");
12572
+ },
12416
12573
  onSuccess: this.handleSuccess
12417
12574
  }));
12418
12575
  }
@@ -12427,7 +12584,7 @@ var VerificationCodeView$1 = /*#__PURE__*/function (_React$Component2) {
12427
12584
  var _super2 = _createSuper(VerificationCodeView);
12428
12585
 
12429
12586
  function VerificationCodeView() {
12430
- var _this2;
12587
+ var _this3;
12431
12588
 
12432
12589
  _classCallCheck(this, VerificationCodeView);
12433
12590
 
@@ -12435,26 +12592,30 @@ var VerificationCodeView$1 = /*#__PURE__*/function (_React$Component2) {
12435
12592
  args[_key2] = arguments[_key2];
12436
12593
  }
12437
12594
 
12438
- _this2 = _super2.call.apply(_super2, [this].concat(args));
12595
+ _this3 = _super2.call.apply(_super2, [this].concat(args));
12439
12596
 
12440
- _defineProperty(_assertThisInitialized(_this2), "handleSubmit", function (data) {
12441
- var _this2$props = _this2.props,
12442
- apiClient = _this2$props.apiClient,
12443
- auth = _this2$props.auth,
12444
- phoneNumber = _this2$props.phoneNumber;
12597
+ _defineProperty(_assertThisInitialized(_this3), "handleSubmit", function (data) {
12598
+ var _this3$props = _this3.props,
12599
+ apiClient = _this3$props.apiClient,
12600
+ auth = _this3$props.auth,
12601
+ phoneNumber = _this3$props.phoneNumber;
12445
12602
  return apiClient.verifyPasswordless(_objectSpread2({
12446
12603
  phoneNumber: phoneNumber
12447
12604
  }, data), auth);
12448
12605
  });
12449
12606
 
12450
- return _this2;
12607
+ return _this3;
12451
12608
  }
12452
12609
 
12453
12610
  _createClass(VerificationCodeView, [{
12454
12611
  key: "render",
12455
12612
  value: function render() {
12613
+ var _this4 = this;
12614
+
12456
12615
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Info, null, this.props.i18n('passwordless.sms.verification.intro')), /*#__PURE__*/React__default.createElement(VerificationCodeInputForm$1, {
12457
- handler: this.handleSubmit
12616
+ handler: function handler(data) {
12617
+ return ReCaptcha.handle(data, _this4.props, _this4.handleSubmit, "verify_passwordless_sms");
12618
+ }
12458
12619
  }));
12459
12620
  }
12460
12621
  }]);