@reachfive/identity-ui 1.13.0 → 1.16.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/CHANGELOG.md +59 -17
- package/cjs/identity-ui.js +628 -83
- package/es/identity-ui.js +628 -83
- package/package.json +3 -3
- package/umd/identity-ui.js +14917 -12008
- package/umd/identity-ui.min.js +1 -1
package/es/identity-ui.js
CHANGED
|
@@ -9,8 +9,8 @@ import { Transition } from 'react-transition-group';
|
|
|
9
9
|
import classes from 'classnames';
|
|
10
10
|
import { Remarkable } from 'remarkable';
|
|
11
11
|
import validator, { isISO8601, isNumeric } from 'validator';
|
|
12
|
-
import { isEqual } from 'lodash-es';
|
|
13
12
|
import { AsYouType, format as format$1, isValidNumber, parse } from 'libphonenumber-js';
|
|
13
|
+
import { isEqual } from 'lodash-es';
|
|
14
14
|
import { isLower, isUpper, isDigit } from 'char-info';
|
|
15
15
|
import zxcvbn from '@reachfive/zxcvbn';
|
|
16
16
|
|
|
@@ -4068,10 +4068,15 @@ function multiViewWidget(_ref3) {
|
|
|
4068
4068
|
}), _temp;
|
|
4069
4069
|
}
|
|
4070
4070
|
|
|
4071
|
-
/* Returns whether a form value has been set with a valid value
|
|
4071
|
+
/* Returns whether a form value has been set with a valid value.
|
|
4072
|
+
* If the user's input has been enriched as an object, raw input is expected
|
|
4073
|
+
* to be in a raw property field (named 'raw' by default).
|
|
4074
|
+
*/
|
|
4072
4075
|
|
|
4073
4076
|
function isValued(v) {
|
|
4074
|
-
|
|
4077
|
+
var rawProperty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'raw';
|
|
4078
|
+
var unwrap = isObject(v) ? v[rawProperty] : v;
|
|
4079
|
+
return unwrap !== null && unwrap !== undefined && unwrap !== '' && !Number.isNaN(unwrap) && (Array.isArray(unwrap) ? unwrap.length > 0 : true);
|
|
4075
4080
|
}
|
|
4076
4081
|
function formatISO8601Date(year, month, day) {
|
|
4077
4082
|
if (isValued(year) && isValued(month) && isValued(day)) {
|
|
@@ -4080,6 +4085,15 @@ function formatISO8601Date(year, month, day) {
|
|
|
4080
4085
|
|
|
4081
4086
|
return null;
|
|
4082
4087
|
}
|
|
4088
|
+
function specializeIdentifierData(data) {
|
|
4089
|
+
return !!data.identifier ? _objectSpread2(_objectSpread2({}, data), {}, {
|
|
4090
|
+
identifier: undefined
|
|
4091
|
+
}, /@/.test(data.identifier) ? {
|
|
4092
|
+
email: data.identifier
|
|
4093
|
+
} : {
|
|
4094
|
+
phoneNumber: data.identifier.replace(/\s+/g, '')
|
|
4095
|
+
}) : data;
|
|
4096
|
+
}
|
|
4083
4097
|
|
|
4084
4098
|
var CompoundValidator = /*#__PURE__*/function () {
|
|
4085
4099
|
function CompoundValidator(current, next) {
|
|
@@ -4118,7 +4132,9 @@ var Validator = /*#__PURE__*/function () {
|
|
|
4118
4132
|
_classCallCheck(this, Validator);
|
|
4119
4133
|
|
|
4120
4134
|
this.rule = rule;
|
|
4121
|
-
this.hint = hint
|
|
4135
|
+
this.hint = !isFunction(hint) ? function (_) {
|
|
4136
|
+
return hint;
|
|
4137
|
+
} : hint;
|
|
4122
4138
|
this.parameters = parameters;
|
|
4123
4139
|
}
|
|
4124
4140
|
|
|
@@ -4127,10 +4143,13 @@ var Validator = /*#__PURE__*/function () {
|
|
|
4127
4143
|
value: function create(i18n) {
|
|
4128
4144
|
var _this = this;
|
|
4129
4145
|
|
|
4130
|
-
var errorMessage =
|
|
4146
|
+
var errorMessage = function errorMessage(v) {
|
|
4147
|
+
return i18n("validation.".concat(_this.hint(v)), _this.parameters);
|
|
4148
|
+
};
|
|
4149
|
+
|
|
4131
4150
|
return function (value, ctx) {
|
|
4132
4151
|
return !_this.rule(value, ctx) && {
|
|
4133
|
-
error: errorMessage
|
|
4152
|
+
error: errorMessage(value)
|
|
4134
4153
|
};
|
|
4135
4154
|
};
|
|
4136
4155
|
}
|
|
@@ -8803,6 +8822,8 @@ var createField = function createField(_ref) {
|
|
|
8803
8822
|
return !isEmpty(x) ? x : null;
|
|
8804
8823
|
}
|
|
8805
8824
|
} : _ref$format,
|
|
8825
|
+
_ref$rawProperty = _ref.rawProperty,
|
|
8826
|
+
rawProperty = _ref$rawProperty === void 0 ? 'raw' : _ref$rawProperty,
|
|
8806
8827
|
component = _ref.component,
|
|
8807
8828
|
_ref$extendedParams = _ref.extendedParams,
|
|
8808
8829
|
extendedParams = _ref$extendedParams === void 0 ? {} : _ref$extendedParams;
|
|
@@ -8836,7 +8857,7 @@ var createField = function createField(_ref) {
|
|
|
8836
8857
|
},
|
|
8837
8858
|
initialize: function initialize(model) {
|
|
8838
8859
|
var modelValue = mapping.bind(model);
|
|
8839
|
-
var initValue = isValued(modelValue) ? modelValue : defaultValue;
|
|
8860
|
+
var initValue = isValued(modelValue, rawProperty) ? modelValue : defaultValue;
|
|
8840
8861
|
return {
|
|
8841
8862
|
value: format.bind(initValue),
|
|
8842
8863
|
isDirty: false
|
|
@@ -9103,6 +9124,310 @@ function checkboxField(config) {
|
|
|
9103
9124
|
}));
|
|
9104
9125
|
}
|
|
9105
9126
|
|
|
9127
|
+
/*
|
|
9128
|
+
* All possible Identifier data is in the `value` prop, they should all be preserved when the type changes.
|
|
9129
|
+
* {
|
|
9130
|
+
* raw: string,
|
|
9131
|
+
* type: 'tel' | 'email' | 'other',
|
|
9132
|
+
* country: string,
|
|
9133
|
+
* formatted: string,
|
|
9134
|
+
* isValid: boolean,
|
|
9135
|
+
* }
|
|
9136
|
+
*/
|
|
9137
|
+
|
|
9138
|
+
function specializeRawIdentifier(inputValue) {
|
|
9139
|
+
var telCall = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (_) {
|
|
9140
|
+
return undefined;
|
|
9141
|
+
};
|
|
9142
|
+
var emailCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (_) {
|
|
9143
|
+
return undefined;
|
|
9144
|
+
};
|
|
9145
|
+
var otherCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (_) {
|
|
9146
|
+
return undefined;
|
|
9147
|
+
};
|
|
9148
|
+
|
|
9149
|
+
if (/^\+?[0-9]+/.test(inputValue)) {
|
|
9150
|
+
return _objectSpread2(_objectSpread2({
|
|
9151
|
+
raw: inputValue
|
|
9152
|
+
}, telCall(inputValue)), {}, {
|
|
9153
|
+
type: 'tel'
|
|
9154
|
+
});
|
|
9155
|
+
} else if (/@/.test(inputValue)) {
|
|
9156
|
+
return _objectSpread2(_objectSpread2({
|
|
9157
|
+
raw: inputValue
|
|
9158
|
+
}, emailCall(inputValue)), {}, {
|
|
9159
|
+
type: 'email'
|
|
9160
|
+
});
|
|
9161
|
+
} else {
|
|
9162
|
+
return _objectSpread2(_objectSpread2({
|
|
9163
|
+
raw: inputValue
|
|
9164
|
+
}, otherCall(inputValue)), {}, {
|
|
9165
|
+
type: 'text'
|
|
9166
|
+
});
|
|
9167
|
+
}
|
|
9168
|
+
}
|
|
9169
|
+
|
|
9170
|
+
function specializeRefinedIdentifier(identifier) {
|
|
9171
|
+
var telCall = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (x) {
|
|
9172
|
+
return x;
|
|
9173
|
+
};
|
|
9174
|
+
var emailCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (x) {
|
|
9175
|
+
return x;
|
|
9176
|
+
};
|
|
9177
|
+
var otherCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (x) {
|
|
9178
|
+
return x;
|
|
9179
|
+
};
|
|
9180
|
+
if (identifier.type === 'tel') return telCall(identifier);else if (identifier.type === 'email') return emailCall(identifier);else return otherCall(identifier);
|
|
9181
|
+
}
|
|
9182
|
+
|
|
9183
|
+
var IdentifierField = /*#__PURE__*/function (_React$Component) {
|
|
9184
|
+
_inherits(IdentifierField, _React$Component);
|
|
9185
|
+
|
|
9186
|
+
var _super = _createSuper(IdentifierField);
|
|
9187
|
+
|
|
9188
|
+
function IdentifierField() {
|
|
9189
|
+
var _this;
|
|
9190
|
+
|
|
9191
|
+
_classCallCheck(this, IdentifierField);
|
|
9192
|
+
|
|
9193
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9194
|
+
args[_key] = arguments[_key];
|
|
9195
|
+
}
|
|
9196
|
+
|
|
9197
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
9198
|
+
|
|
9199
|
+
_defineProperty(_assertThisInitialized(_this), "asYouType", function (inputValue) {
|
|
9200
|
+
var country = _this.props.value.country;
|
|
9201
|
+
var phone = new AsYouType(country).input(inputValue);
|
|
9202
|
+
var formatted = format$1(phone, country, 'International');
|
|
9203
|
+
var isValid = isValidNumber(phone, country);
|
|
9204
|
+
return {
|
|
9205
|
+
country: country,
|
|
9206
|
+
formatted: formatted,
|
|
9207
|
+
isValid: isValid,
|
|
9208
|
+
raw: phone
|
|
9209
|
+
};
|
|
9210
|
+
});
|
|
9211
|
+
|
|
9212
|
+
return _this;
|
|
9213
|
+
}
|
|
9214
|
+
|
|
9215
|
+
_createClass(IdentifierField, [{
|
|
9216
|
+
key: "componentDidMount",
|
|
9217
|
+
value: function componentDidMount() {
|
|
9218
|
+
var _this$props$value = this.props.value,
|
|
9219
|
+
userInput = _this$props$value.userInput,
|
|
9220
|
+
country = _this$props$value.country;
|
|
9221
|
+
|
|
9222
|
+
try {
|
|
9223
|
+
var parsed = parse(userInput, country);
|
|
9224
|
+
var phoneValue = country === parsed.country ? format$1(parsed, 'National') : userInput;
|
|
9225
|
+
this.asYouType(phoneValue);
|
|
9226
|
+
} catch (e) {}
|
|
9227
|
+
}
|
|
9228
|
+
}, {
|
|
9229
|
+
key: "componentWillUnmount",
|
|
9230
|
+
value: function componentWillUnmount() {
|
|
9231
|
+
this.unmounted = true;
|
|
9232
|
+
}
|
|
9233
|
+
}, {
|
|
9234
|
+
key: "render",
|
|
9235
|
+
value: function render() {
|
|
9236
|
+
var _this2 = this;
|
|
9237
|
+
|
|
9238
|
+
var _this$props = this.props,
|
|
9239
|
+
path = _this$props.path,
|
|
9240
|
+
value = _this$props.value,
|
|
9241
|
+
_this$props$validatio = _this$props.validation,
|
|
9242
|
+
validation = _this$props$validatio === void 0 ? {} : _this$props$validatio,
|
|
9243
|
+
inputId = _this$props.inputId,
|
|
9244
|
+
_this$props$required = _this$props.required,
|
|
9245
|
+
required = _this$props$required === void 0 ? true : _this$props$required,
|
|
9246
|
+
label = _this$props.label,
|
|
9247
|
+
_this$props$placehold = _this$props.placeholder,
|
|
9248
|
+
placeholder = _this$props$placehold === void 0 ? label : _this$props$placehold,
|
|
9249
|
+
readOnly = _this$props.readOnly;
|
|
9250
|
+
return /*#__PURE__*/React__default.createElement(FormGroup, _extends({
|
|
9251
|
+
inputId: inputId,
|
|
9252
|
+
labelText: label
|
|
9253
|
+
}, pick(validation, 'error'), {
|
|
9254
|
+
showLabel: this.props.showLabel
|
|
9255
|
+
}), /*#__PURE__*/React__default.createElement(Input, {
|
|
9256
|
+
id: inputId,
|
|
9257
|
+
name: path,
|
|
9258
|
+
type: value.type,
|
|
9259
|
+
value: value.raw || '',
|
|
9260
|
+
placeholder: placeholder,
|
|
9261
|
+
title: label,
|
|
9262
|
+
required: required,
|
|
9263
|
+
readOnly: readOnly,
|
|
9264
|
+
hasError: !!validation.error,
|
|
9265
|
+
onChange: function onChange(event) {
|
|
9266
|
+
return _this2.props.onChange({
|
|
9267
|
+
value: _objectSpread2(_objectSpread2({}, _this2.props.value), specializeRawIdentifier(event.target.value, _this2.asYouType))
|
|
9268
|
+
});
|
|
9269
|
+
},
|
|
9270
|
+
onBlur: function onBlur() {
|
|
9271
|
+
return _this2.props.onChange({
|
|
9272
|
+
isDirty: true
|
|
9273
|
+
});
|
|
9274
|
+
},
|
|
9275
|
+
"data-testid": path
|
|
9276
|
+
}));
|
|
9277
|
+
}
|
|
9278
|
+
}]);
|
|
9279
|
+
|
|
9280
|
+
return IdentifierField;
|
|
9281
|
+
}(React__default.Component);
|
|
9282
|
+
|
|
9283
|
+
function identifierField(props, config) {
|
|
9284
|
+
return createField(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
9285
|
+
key: 'identifier',
|
|
9286
|
+
label: 'identifier',
|
|
9287
|
+
format: {
|
|
9288
|
+
bind: function bind(x) {
|
|
9289
|
+
return specializeRawIdentifier(x, function (_) {
|
|
9290
|
+
return {
|
|
9291
|
+
country: config.countryCode,
|
|
9292
|
+
isValid: true
|
|
9293
|
+
};
|
|
9294
|
+
}, function (_) {
|
|
9295
|
+
return {
|
|
9296
|
+
country: config.countryCode,
|
|
9297
|
+
isValid: true
|
|
9298
|
+
};
|
|
9299
|
+
}, function (_) {
|
|
9300
|
+
return {
|
|
9301
|
+
country: config.countryCode,
|
|
9302
|
+
isValid: true
|
|
9303
|
+
};
|
|
9304
|
+
});
|
|
9305
|
+
},
|
|
9306
|
+
unbind: function unbind(x) {
|
|
9307
|
+
return specializeRefinedIdentifier(x, function (v) {
|
|
9308
|
+
return v.formatted || v.raw;
|
|
9309
|
+
}, function (v) {
|
|
9310
|
+
return v.raw;
|
|
9311
|
+
}, function (v) {
|
|
9312
|
+
return v.raw;
|
|
9313
|
+
});
|
|
9314
|
+
}
|
|
9315
|
+
},
|
|
9316
|
+
validator: new Validator({
|
|
9317
|
+
rule: function rule(value) {
|
|
9318
|
+
return specializeRefinedIdentifier(value, function (v) {
|
|
9319
|
+
return v.isValid;
|
|
9320
|
+
}, function (v) {
|
|
9321
|
+
return email.rule(v.raw);
|
|
9322
|
+
}, function (_) {
|
|
9323
|
+
return false;
|
|
9324
|
+
});
|
|
9325
|
+
},
|
|
9326
|
+
hint: function hint(value) {
|
|
9327
|
+
return specializeRefinedIdentifier(value, function (_) {
|
|
9328
|
+
return 'phone';
|
|
9329
|
+
}, function (_) {
|
|
9330
|
+
return 'email';
|
|
9331
|
+
}, function (_) {
|
|
9332
|
+
return 'identifier';
|
|
9333
|
+
});
|
|
9334
|
+
}
|
|
9335
|
+
}),
|
|
9336
|
+
component: IdentifierField
|
|
9337
|
+
}));
|
|
9338
|
+
}
|
|
9339
|
+
|
|
9340
|
+
var ReCaptcha = function ReCaptcha() {
|
|
9341
|
+
_classCallCheck(this, ReCaptcha);
|
|
9342
|
+
};
|
|
9343
|
+
|
|
9344
|
+
_defineProperty(ReCaptcha, "getRecaptchaToken", /*#__PURE__*/function () {
|
|
9345
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(siteKey, action) {
|
|
9346
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
9347
|
+
while (1) {
|
|
9348
|
+
switch (_context.prev = _context.next) {
|
|
9349
|
+
case 0:
|
|
9350
|
+
_context.next = 2;
|
|
9351
|
+
return window.grecaptcha.execute(siteKey, {
|
|
9352
|
+
action: action
|
|
9353
|
+
});
|
|
9354
|
+
|
|
9355
|
+
case 2:
|
|
9356
|
+
return _context.abrupt("return", _context.sent);
|
|
9357
|
+
|
|
9358
|
+
case 3:
|
|
9359
|
+
case "end":
|
|
9360
|
+
return _context.stop();
|
|
9361
|
+
}
|
|
9362
|
+
}
|
|
9363
|
+
}, _callee);
|
|
9364
|
+
}));
|
|
9365
|
+
|
|
9366
|
+
return function (_x, _x2) {
|
|
9367
|
+
return _ref.apply(this, arguments);
|
|
9368
|
+
};
|
|
9369
|
+
}());
|
|
9370
|
+
|
|
9371
|
+
_defineProperty(ReCaptcha, "handle", /*#__PURE__*/function () {
|
|
9372
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(data, conf, callback, action) {
|
|
9373
|
+
var captchaToken;
|
|
9374
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
9375
|
+
while (1) {
|
|
9376
|
+
switch (_context2.prev = _context2.next) {
|
|
9377
|
+
case 0:
|
|
9378
|
+
if (!conf.recaptcha_enabled) {
|
|
9379
|
+
_context2.next = 13;
|
|
9380
|
+
break;
|
|
9381
|
+
}
|
|
9382
|
+
|
|
9383
|
+
_context2.prev = 1;
|
|
9384
|
+
_context2.next = 4;
|
|
9385
|
+
return ReCaptcha.getRecaptchaToken(conf.recaptcha_site_key, action);
|
|
9386
|
+
|
|
9387
|
+
case 4:
|
|
9388
|
+
captchaToken = _context2.sent;
|
|
9389
|
+
return _context2.abrupt("return", callback(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
9390
|
+
captchaToken: captchaToken
|
|
9391
|
+
})));
|
|
9392
|
+
|
|
9393
|
+
case 8:
|
|
9394
|
+
_context2.prev = 8;
|
|
9395
|
+
_context2.t0 = _context2["catch"](1);
|
|
9396
|
+
return _context2.abrupt("return", Promise.reject({
|
|
9397
|
+
errorUserMsg: "Error recaptcha",
|
|
9398
|
+
errorMessageKey: "recaptcha.error"
|
|
9399
|
+
}));
|
|
9400
|
+
|
|
9401
|
+
case 11:
|
|
9402
|
+
_context2.next = 14;
|
|
9403
|
+
break;
|
|
9404
|
+
|
|
9405
|
+
case 13:
|
|
9406
|
+
return _context2.abrupt("return", callback(data));
|
|
9407
|
+
|
|
9408
|
+
case 14:
|
|
9409
|
+
case "end":
|
|
9410
|
+
return _context2.stop();
|
|
9411
|
+
}
|
|
9412
|
+
}
|
|
9413
|
+
}, _callee2, null, [[1, 8]]);
|
|
9414
|
+
}));
|
|
9415
|
+
|
|
9416
|
+
return function (_x3, _x4, _x5, _x6) {
|
|
9417
|
+
return _ref2.apply(this, arguments);
|
|
9418
|
+
};
|
|
9419
|
+
}());
|
|
9420
|
+
function importGoogleRecaptchaScript(site_key) {
|
|
9421
|
+
var script = document.createElement("script");
|
|
9422
|
+
script.src = "https://www.google.com/recaptcha/api.js?render=" + site_key;
|
|
9423
|
+
document.body.appendChild(script);
|
|
9424
|
+
}
|
|
9425
|
+
function extractCaptchaTokenFromData(data) {
|
|
9426
|
+
var token = data.captchaToken;
|
|
9427
|
+
delete data.captchaToken;
|
|
9428
|
+
return token;
|
|
9429
|
+
}
|
|
9430
|
+
|
|
9106
9431
|
function _templateObject$7() {
|
|
9107
9432
|
var data = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n text-align: right;\n ", ";\n"]);
|
|
9108
9433
|
|
|
@@ -9120,19 +9445,22 @@ var ForgotPasswordWrapper = withTheme(styled.div(_templateObject$7(), function (
|
|
|
9120
9445
|
var LoginForm = createForm({
|
|
9121
9446
|
prefix: 'r5-login-',
|
|
9122
9447
|
fields: function fields(_ref) {
|
|
9123
|
-
var _ref$
|
|
9124
|
-
|
|
9448
|
+
var _ref$showIdentifier = _ref.showIdentifier,
|
|
9449
|
+
showIdentifier = _ref$showIdentifier === void 0 ? true : _ref$showIdentifier,
|
|
9125
9450
|
showRememberMe = _ref.showRememberMe,
|
|
9126
9451
|
canShowPassword = _ref.canShowPassword,
|
|
9127
9452
|
showForgotPassword = _ref.showForgotPassword,
|
|
9128
|
-
|
|
9129
|
-
i18n = _ref.i18n
|
|
9130
|
-
|
|
9453
|
+
defaultIdentifier = _ref.defaultIdentifier,
|
|
9454
|
+
i18n = _ref.i18n,
|
|
9455
|
+
config = _ref.config;
|
|
9456
|
+
return [showIdentifier && config.sms ? identifierField({
|
|
9457
|
+
defaultValue: defaultIdentifier
|
|
9458
|
+
}, config) : simpleField({
|
|
9131
9459
|
key: 'email',
|
|
9132
9460
|
label: 'email',
|
|
9133
9461
|
type: 'email',
|
|
9134
9462
|
autoComplete: 'email',
|
|
9135
|
-
defaultValue:
|
|
9463
|
+
defaultValue: defaultIdentifier,
|
|
9136
9464
|
validator: email
|
|
9137
9465
|
}), simplePasswordField({
|
|
9138
9466
|
key: 'password',
|
|
@@ -9171,9 +9499,11 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9171
9499
|
|
|
9172
9500
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
9173
9501
|
|
|
9174
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
9175
|
-
|
|
9176
|
-
|
|
9502
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
9503
|
+
var specializedData = specializeIdentifierData(data);
|
|
9504
|
+
return _this.props.apiClient.loginWithPassword(_objectSpread2(_objectSpread2({}, specializedData), {}, {
|
|
9505
|
+
captchaToken: data.captchaToken,
|
|
9506
|
+
auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
|
|
9177
9507
|
}));
|
|
9178
9508
|
});
|
|
9179
9509
|
|
|
@@ -9181,14 +9511,21 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9181
9511
|
}
|
|
9182
9512
|
|
|
9183
9513
|
_createClass(LoginView, [{
|
|
9514
|
+
key: "componentDidMount",
|
|
9515
|
+
value: function componentDidMount() {
|
|
9516
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
9517
|
+
}
|
|
9518
|
+
}, {
|
|
9184
9519
|
key: "render",
|
|
9185
9520
|
value: function render() {
|
|
9521
|
+
var _this2 = this;
|
|
9522
|
+
|
|
9186
9523
|
var _this$props = this.props,
|
|
9187
9524
|
socialProviders = _this$props.socialProviders,
|
|
9188
9525
|
_this$props$session = _this$props.session,
|
|
9189
9526
|
session = _this$props$session === void 0 ? {} : _this$props$session,
|
|
9190
9527
|
i18n = _this$props.i18n;
|
|
9191
|
-
var
|
|
9528
|
+
var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
|
|
9192
9529
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(SocialButtons$1, {
|
|
9193
9530
|
providers: socialProviders,
|
|
9194
9531
|
auth: this.props.auth,
|
|
@@ -9200,8 +9537,11 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9200
9537
|
showRememberMe: this.props.showRememberMe,
|
|
9201
9538
|
showForgotPassword: this.props.allowForgotPassword,
|
|
9202
9539
|
canShowPassword: this.props.canShowPassword,
|
|
9203
|
-
|
|
9204
|
-
handler:
|
|
9540
|
+
defaultIdentifier: defaultIdentifier,
|
|
9541
|
+
handler: function handler(data) {
|
|
9542
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "login");
|
|
9543
|
+
},
|
|
9544
|
+
config: this.props.config
|
|
9205
9545
|
}), this.props.allowSignup && /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement("span", null, i18n('login.signupLinkPrefix')), "\xA0", /*#__PURE__*/React__default.createElement(Link, {
|
|
9206
9546
|
target: "signup"
|
|
9207
9547
|
}, i18n('login.signupLink'))));
|
|
@@ -9383,15 +9723,18 @@ var WebAuthnSignupViewButtons = styled(function (_ref3) {
|
|
|
9383
9723
|
var LoginWithWebAuthnForm = createForm({
|
|
9384
9724
|
prefix: 'r5-login-',
|
|
9385
9725
|
fields: function fields(_ref) {
|
|
9386
|
-
var _ref$
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9726
|
+
var _ref$showIdentifier = _ref.showIdentifier,
|
|
9727
|
+
showIdentifier = _ref$showIdentifier === void 0 ? true : _ref$showIdentifier,
|
|
9728
|
+
defaultIdentifier = _ref.defaultIdentifier,
|
|
9729
|
+
config = _ref.config;
|
|
9730
|
+
return [showIdentifier && config.sms ? identifierField({
|
|
9731
|
+
defaultValue: defaultIdentifier
|
|
9732
|
+
}, config) : simpleField({
|
|
9390
9733
|
key: 'email',
|
|
9391
9734
|
label: 'email',
|
|
9392
9735
|
type: 'email',
|
|
9393
9736
|
autoComplete: 'email',
|
|
9394
|
-
defaultValue:
|
|
9737
|
+
defaultValue: defaultIdentifier,
|
|
9395
9738
|
validator: email
|
|
9396
9739
|
})];
|
|
9397
9740
|
},
|
|
@@ -9415,14 +9758,17 @@ var LoginWithWebAuthnView = /*#__PURE__*/function (_React$Component) {
|
|
|
9415
9758
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
9416
9759
|
|
|
9417
9760
|
_defineProperty(_assertThisInitialized(_this), "handleWebAuthnLogin", function (data) {
|
|
9418
|
-
|
|
9419
|
-
|
|
9761
|
+
var specializedData = specializeIdentifierData(data);
|
|
9762
|
+
return _this.props.apiClient.loginWithWebAuthn(_objectSpread2(_objectSpread2({}, specializedData), {}, {
|
|
9763
|
+
auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
|
|
9420
9764
|
}));
|
|
9421
9765
|
});
|
|
9422
9766
|
|
|
9423
9767
|
_defineProperty(_assertThisInitialized(_this), "redirectToPasswordLoginView", function (data) {
|
|
9768
|
+
var username = data.identifier || data.email;
|
|
9769
|
+
|
|
9424
9770
|
_this.props.goTo('login-with-password', {
|
|
9425
|
-
username:
|
|
9771
|
+
username: username
|
|
9426
9772
|
});
|
|
9427
9773
|
});
|
|
9428
9774
|
|
|
@@ -9437,7 +9783,7 @@ var LoginWithWebAuthnView = /*#__PURE__*/function (_React$Component) {
|
|
|
9437
9783
|
_this$props$session = _this$props.session,
|
|
9438
9784
|
session = _this$props$session === void 0 ? {} : _this$props$session,
|
|
9439
9785
|
i18n = _this$props.i18n;
|
|
9440
|
-
var
|
|
9786
|
+
var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
|
|
9441
9787
|
|
|
9442
9788
|
var webAuthnButtons = function webAuthnButtons(disabled, handleClick) {
|
|
9443
9789
|
return /*#__PURE__*/React__default.createElement(WebAuthnLoginViewButtons, {
|
|
@@ -9455,10 +9801,11 @@ var LoginWithWebAuthnView = /*#__PURE__*/function (_React$Component) {
|
|
|
9455
9801
|
text: i18n('or')
|
|
9456
9802
|
}), /*#__PURE__*/React__default.createElement(LoginWithWebAuthnForm, {
|
|
9457
9803
|
showLabels: this.props.showLabels,
|
|
9458
|
-
|
|
9804
|
+
defaultIdentifier: defaultIdentifier,
|
|
9459
9805
|
handler: this.handleWebAuthnLogin,
|
|
9460
9806
|
redirect: this.redirectToPasswordLoginView,
|
|
9461
|
-
webAuthnButtons: webAuthnButtons
|
|
9807
|
+
webAuthnButtons: webAuthnButtons,
|
|
9808
|
+
config: this.props.config
|
|
9462
9809
|
}), this.props.allowSignup && /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement("span", null, i18n('login.signupLinkPrefix')), "\xA0", /*#__PURE__*/React__default.createElement(Link, {
|
|
9463
9810
|
target: "signup"
|
|
9464
9811
|
}, i18n('login.signupLink'))));
|
|
@@ -9489,8 +9836,13 @@ var LoginWithPasswordForm = createForm({
|
|
|
9489
9836
|
showRememberMe = _ref.showRememberMe,
|
|
9490
9837
|
canShowPassword = _ref.canShowPassword,
|
|
9491
9838
|
showForgotPassword = _ref.showForgotPassword,
|
|
9492
|
-
i18n = _ref.i18n
|
|
9493
|
-
|
|
9839
|
+
i18n = _ref.i18n,
|
|
9840
|
+
config = _ref.config;
|
|
9841
|
+
return [config.sms ? identifierField({
|
|
9842
|
+
key: 'identifier',
|
|
9843
|
+
defaultValue: username,
|
|
9844
|
+
readOnly: true
|
|
9845
|
+
}, config) : simpleField({
|
|
9494
9846
|
key: 'email',
|
|
9495
9847
|
label: 'email',
|
|
9496
9848
|
type: 'email',
|
|
@@ -9534,9 +9886,11 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
9534
9886
|
|
|
9535
9887
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
9536
9888
|
|
|
9537
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
9538
|
-
|
|
9539
|
-
|
|
9889
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
9890
|
+
var specializedData = specializeIdentifierData(data);
|
|
9891
|
+
return _this.props.apiClient.loginWithPassword(_objectSpread2(_objectSpread2({}, specializedData), {}, {
|
|
9892
|
+
captchaToken: data.captchaToken,
|
|
9893
|
+
auth: _objectSpread2(_objectSpread2({}, specializedData.auth), _this.props.auth)
|
|
9540
9894
|
}));
|
|
9541
9895
|
});
|
|
9542
9896
|
|
|
@@ -9544,8 +9898,15 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
9544
9898
|
}
|
|
9545
9899
|
|
|
9546
9900
|
_createClass(LoginView, [{
|
|
9901
|
+
key: "componentDidMount",
|
|
9902
|
+
value: function componentDidMount() {
|
|
9903
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
9904
|
+
}
|
|
9905
|
+
}, {
|
|
9547
9906
|
key: "render",
|
|
9548
9907
|
value: function render() {
|
|
9908
|
+
var _this2 = this;
|
|
9909
|
+
|
|
9549
9910
|
var i18n = this.props.i18n;
|
|
9550
9911
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), /*#__PURE__*/React__default.createElement(LoginWithPasswordForm, {
|
|
9551
9912
|
username: this.props.username,
|
|
@@ -9553,7 +9914,10 @@ var LoginView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
9553
9914
|
showRememberMe: this.props.showRememberMe,
|
|
9554
9915
|
showForgotPassword: this.props.allowForgotPassword,
|
|
9555
9916
|
canShowPassword: this.props.canShowPassword,
|
|
9556
|
-
handler:
|
|
9917
|
+
handler: function handler(data) {
|
|
9918
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "login");
|
|
9919
|
+
},
|
|
9920
|
+
config: this.props.config
|
|
9557
9921
|
}), /*#__PURE__*/React__default.createElement(Alternative, null, /*#__PURE__*/React__default.createElement(Link, {
|
|
9558
9922
|
target: "login-with-web-authn"
|
|
9559
9923
|
}, i18n('login.password.userAnotherIdentifier'))));
|
|
@@ -10173,7 +10537,7 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
10173
10537
|
_this.props.onChange({
|
|
10174
10538
|
value: {
|
|
10175
10539
|
country: country,
|
|
10176
|
-
|
|
10540
|
+
raw: phone,
|
|
10177
10541
|
formatted: formatted,
|
|
10178
10542
|
isValid: isValid
|
|
10179
10543
|
}
|
|
@@ -10187,12 +10551,12 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
10187
10551
|
key: "componentDidMount",
|
|
10188
10552
|
value: function componentDidMount() {
|
|
10189
10553
|
var _this$props$value = this.props.value,
|
|
10190
|
-
|
|
10554
|
+
raw = _this$props$value.raw,
|
|
10191
10555
|
country = _this$props$value.country;
|
|
10192
10556
|
|
|
10193
10557
|
try {
|
|
10194
|
-
var parsed = parse(
|
|
10195
|
-
var phoneValue = country === parsed.country ? format$1(parsed, 'National') :
|
|
10558
|
+
var parsed = parse(raw, country);
|
|
10559
|
+
var phoneValue = country === parsed.country ? format$1(parsed, 'National') : raw;
|
|
10196
10560
|
this.asYouType(phoneValue);
|
|
10197
10561
|
} catch (e) {}
|
|
10198
10562
|
}
|
|
@@ -10226,7 +10590,7 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
10226
10590
|
id: inputId,
|
|
10227
10591
|
name: path,
|
|
10228
10592
|
type: "tel",
|
|
10229
|
-
value: value.
|
|
10593
|
+
value: value.raw || '',
|
|
10230
10594
|
placeholder: placeholder,
|
|
10231
10595
|
title: label,
|
|
10232
10596
|
required: required,
|
|
@@ -10255,12 +10619,12 @@ function phoneNumberField(props, config) {
|
|
|
10255
10619
|
bind: function bind(x) {
|
|
10256
10620
|
return {
|
|
10257
10621
|
country: config.countryCode,
|
|
10258
|
-
|
|
10622
|
+
raw: x,
|
|
10259
10623
|
isValid: true
|
|
10260
10624
|
};
|
|
10261
10625
|
},
|
|
10262
10626
|
unbind: function unbind(x) {
|
|
10263
|
-
return x.formatted || x.
|
|
10627
|
+
return x.formatted || x.raw;
|
|
10264
10628
|
}
|
|
10265
10629
|
},
|
|
10266
10630
|
validator: new Validator({
|
|
@@ -10756,11 +11120,13 @@ function consentField(config) {
|
|
|
10756
11120
|
unbind: function unbind(x) {
|
|
10757
11121
|
return {
|
|
10758
11122
|
granted: x,
|
|
10759
|
-
consentType: config.type
|
|
11123
|
+
consentType: config.type,
|
|
11124
|
+
consentVersion: config.extendedParams.version
|
|
10760
11125
|
};
|
|
10761
11126
|
}
|
|
10762
11127
|
},
|
|
10763
11128
|
validator: config.required ? checked : empty,
|
|
11129
|
+
rawProperty: 'granted',
|
|
10764
11130
|
component: ConsentField
|
|
10765
11131
|
}));
|
|
10766
11132
|
}
|
|
@@ -10926,15 +11292,31 @@ function customFieldComponent(customField, cfg) {
|
|
|
10926
11292
|
}
|
|
10927
11293
|
}
|
|
10928
11294
|
|
|
10929
|
-
function consentFieldComponent(consent, fieldConfig) {
|
|
11295
|
+
function consentFieldComponent(consent, fieldConfig, versionIdPath, language) {
|
|
10930
11296
|
if (fieldConfig.errorArchivedConsents && consent.status === 'archived') {
|
|
10931
11297
|
throw new UserError("The '".concat(consent.key, "' consent is archived and cannot be displayed."));
|
|
11298
|
+
} // If the version ID is not defined in the path, get the latest version ID
|
|
11299
|
+
|
|
11300
|
+
|
|
11301
|
+
var versionId = parseInt(versionIdPath || Math.max.apply(Math, _toConsumableArray(Object.values(consent.versions.map(function (v) {
|
|
11302
|
+
return v.versionId;
|
|
11303
|
+
})))));
|
|
11304
|
+
var version = consent.versions.find(function (version) {
|
|
11305
|
+
return version.versionId === versionId;
|
|
11306
|
+
});
|
|
11307
|
+
|
|
11308
|
+
if (!version) {
|
|
11309
|
+
throw new UserError("Unknown version ID n\xB0".concat(versionId, " of consent '").concat(consent.key, "'."));
|
|
10932
11310
|
}
|
|
10933
11311
|
|
|
10934
11312
|
var baseConfig = _objectSpread2(_objectSpread2({}, fieldConfig), {}, {
|
|
10935
|
-
label:
|
|
11313
|
+
label: version.title,
|
|
10936
11314
|
extendedParams: {
|
|
10937
|
-
|
|
11315
|
+
version: {
|
|
11316
|
+
versionId: versionId,
|
|
11317
|
+
language: language
|
|
11318
|
+
},
|
|
11319
|
+
description: version.description,
|
|
10938
11320
|
consentCannotBeGranted: !fieldConfig.errorArchivedConsents && consent.status === 'archived'
|
|
10939
11321
|
},
|
|
10940
11322
|
type: consent.consentType,
|
|
@@ -10952,7 +11334,7 @@ var findCustomField = function findCustomField(config, camelPath) {
|
|
|
10952
11334
|
};
|
|
10953
11335
|
|
|
10954
11336
|
var findConsentField = function findConsentField(config, camelPath) {
|
|
10955
|
-
return find(config.
|
|
11337
|
+
return find(config.consentsVersions, function (f) {
|
|
10956
11338
|
var fieldCamelPath = camelCase(f.key);
|
|
10957
11339
|
return camelPath === fieldCamelPath || camelPath === "consents.".concat(fieldCamelPath);
|
|
10958
11340
|
});
|
|
@@ -10971,10 +11353,11 @@ var resolveField = function resolveField(fieldConfig, config) {
|
|
|
10971
11353
|
return customFieldComponent(customField, fieldConfig);
|
|
10972
11354
|
}
|
|
10973
11355
|
|
|
10974
|
-
var
|
|
11356
|
+
var camelPathSplit = camelPath.split('.v');
|
|
11357
|
+
var consentField = findConsentField(config, camelPathSplit[0]);
|
|
10975
11358
|
|
|
10976
11359
|
if (consentField) {
|
|
10977
|
-
return consentFieldComponent(consentField, fieldConfig);
|
|
11360
|
+
return consentFieldComponent(consentField, fieldConfig, camelPathSplit[1], config.language);
|
|
10978
11361
|
}
|
|
10979
11362
|
|
|
10980
11363
|
throw new UserError("Unknown field: ".concat(fieldConfig.key));
|
|
@@ -11031,8 +11414,10 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
|
|
|
11031
11414
|
blacklist: []
|
|
11032
11415
|
});
|
|
11033
11416
|
|
|
11034
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
11417
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11418
|
+
var captchaToken = extractCaptchaTokenFromData(data);
|
|
11035
11419
|
return _this.props.apiClient.signup({
|
|
11420
|
+
captchaToken: captchaToken,
|
|
11036
11421
|
data: snakeCaseProperties(data),
|
|
11037
11422
|
auth: _this.props.auth,
|
|
11038
11423
|
redirectUrl: _this.props && _this.props.redirectUrl,
|
|
@@ -11062,8 +11447,15 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
|
|
|
11062
11447
|
}
|
|
11063
11448
|
|
|
11064
11449
|
_createClass(PasswordSignupForm, [{
|
|
11450
|
+
key: "componentDidMount",
|
|
11451
|
+
value: function componentDidMount() {
|
|
11452
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
11453
|
+
}
|
|
11454
|
+
}, {
|
|
11065
11455
|
key: "render",
|
|
11066
11456
|
value: function render() {
|
|
11457
|
+
var _this2 = this;
|
|
11458
|
+
|
|
11067
11459
|
var _this$props = this.props,
|
|
11068
11460
|
_this$props$beforeSig = _this$props.beforeSignup,
|
|
11069
11461
|
beforeSignup = _this$props$beforeSig === void 0 ? function (x) {
|
|
@@ -11094,7 +11486,9 @@ var PasswordSignupForm = /*#__PURE__*/function (_React$Component) {
|
|
|
11094
11486
|
beforeSubmit: beforeSignup,
|
|
11095
11487
|
onFieldChange: this.refreshBlacklist,
|
|
11096
11488
|
sharedProps: sharedProps,
|
|
11097
|
-
handler:
|
|
11489
|
+
handler: function handler(data) {
|
|
11490
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "signup");
|
|
11491
|
+
}
|
|
11098
11492
|
});
|
|
11099
11493
|
}
|
|
11100
11494
|
}]);
|
|
@@ -11252,10 +11646,29 @@ var skipError = function skipError(err) {
|
|
|
11252
11646
|
};
|
|
11253
11647
|
|
|
11254
11648
|
var enhance = withHandlers({
|
|
11255
|
-
|
|
11649
|
+
callback: function callback(_ref) {
|
|
11256
11650
|
var apiClient = _ref.apiClient,
|
|
11257
11651
|
redirectUrl = _ref.redirectUrl,
|
|
11258
|
-
returnToAfterPasswordReset = _ref.returnToAfterPasswordReset
|
|
11652
|
+
returnToAfterPasswordReset = _ref.returnToAfterPasswordReset,
|
|
11653
|
+
recaptcha_enabled = _ref.recaptcha_enabled,
|
|
11654
|
+
recaptcha_site_key = _ref.recaptcha_site_key;
|
|
11655
|
+
return function (data) {
|
|
11656
|
+
return ReCaptcha.handle(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
11657
|
+
redirectUrl: redirectUrl,
|
|
11658
|
+
returnToAfterPasswordReset: returnToAfterPasswordReset
|
|
11659
|
+
}), {
|
|
11660
|
+
apiClient: apiClient,
|
|
11661
|
+
redirectUrl: redirectUrl,
|
|
11662
|
+
returnToAfterPasswordReset: returnToAfterPasswordReset,
|
|
11663
|
+
recaptcha_enabled: recaptcha_enabled,
|
|
11664
|
+
recaptcha_site_key: recaptcha_site_key
|
|
11665
|
+
}, apiClient.requestPasswordReset, "forgot_password");
|
|
11666
|
+
};
|
|
11667
|
+
},
|
|
11668
|
+
handleSubmit: function handleSubmit(_ref2) {
|
|
11669
|
+
var apiClient = _ref2.apiClient,
|
|
11670
|
+
redirectUrl = _ref2.redirectUrl,
|
|
11671
|
+
returnToAfterPasswordReset = _ref2.returnToAfterPasswordReset;
|
|
11259
11672
|
return function (data) {
|
|
11260
11673
|
return apiClient.requestPasswordReset(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
11261
11674
|
redirectUrl: redirectUrl,
|
|
@@ -11264,17 +11677,18 @@ var enhance = withHandlers({
|
|
|
11264
11677
|
};
|
|
11265
11678
|
}
|
|
11266
11679
|
});
|
|
11267
|
-
var ForgotPasswordView = enhance(function (
|
|
11268
|
-
var i18n =
|
|
11269
|
-
goTo =
|
|
11270
|
-
allowLogin =
|
|
11271
|
-
|
|
11272
|
-
displaySafeErrorMessage =
|
|
11273
|
-
showLabels =
|
|
11274
|
-
allowWebAuthnLogin =
|
|
11275
|
-
|
|
11680
|
+
var ForgotPasswordView = enhance(function (_ref3) {
|
|
11681
|
+
var i18n = _ref3.i18n,
|
|
11682
|
+
goTo = _ref3.goTo,
|
|
11683
|
+
allowLogin = _ref3.allowLogin,
|
|
11684
|
+
callback = _ref3.callback,
|
|
11685
|
+
displaySafeErrorMessage = _ref3.displaySafeErrorMessage,
|
|
11686
|
+
showLabels = _ref3.showLabels,
|
|
11687
|
+
allowWebAuthnLogin = _ref3.allowWebAuthnLogin,
|
|
11688
|
+
recaptcha_site_key = _ref3.recaptcha_site_key;
|
|
11689
|
+
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, {
|
|
11276
11690
|
showLabels: showLabels,
|
|
11277
|
-
handler:
|
|
11691
|
+
handler: callback,
|
|
11278
11692
|
onSuccess: function onSuccess() {
|
|
11279
11693
|
return goTo('forgot-password-success');
|
|
11280
11694
|
},
|
|
@@ -11283,10 +11697,10 @@ var ForgotPasswordView = enhance(function (_ref2) {
|
|
|
11283
11697
|
target: allowWebAuthnLogin ? 'login-with-web-authn' : 'login'
|
|
11284
11698
|
}, i18n('forgotPassword.backToLoginLink'))));
|
|
11285
11699
|
});
|
|
11286
|
-
var ForgotPasswordSuccessView = function ForgotPasswordSuccessView(
|
|
11287
|
-
var i18n =
|
|
11288
|
-
allowLogin =
|
|
11289
|
-
allowWebAuthnLogin =
|
|
11700
|
+
var ForgotPasswordSuccessView = function ForgotPasswordSuccessView(_ref4) {
|
|
11701
|
+
var i18n = _ref4.i18n,
|
|
11702
|
+
allowLogin = _ref4.allowLogin,
|
|
11703
|
+
allowWebAuthnLogin = _ref4.allowWebAuthnLogin;
|
|
11290
11704
|
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, {
|
|
11291
11705
|
target: allowWebAuthnLogin ? 'login-with-web-authn' : 'login'
|
|
11292
11706
|
}, i18n('back'))));
|
|
@@ -11860,6 +12274,105 @@ var phoneNumberEditorWidget = createMultiViewWidget({
|
|
|
11860
12274
|
}
|
|
11861
12275
|
});
|
|
11862
12276
|
|
|
12277
|
+
/**
|
|
12278
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
12279
|
+
*
|
|
12280
|
+
* @private
|
|
12281
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
12282
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
12283
|
+
* @returns {Array} Returns the new mapped array.
|
|
12284
|
+
*/
|
|
12285
|
+
|
|
12286
|
+
function baseMap(collection, iteratee) {
|
|
12287
|
+
var index = -1,
|
|
12288
|
+
result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
12289
|
+
baseEach(collection, function (value, key, collection) {
|
|
12290
|
+
result[++index] = iteratee(value, key, collection);
|
|
12291
|
+
});
|
|
12292
|
+
return result;
|
|
12293
|
+
}
|
|
12294
|
+
|
|
12295
|
+
/**
|
|
12296
|
+
* Creates an array of values by running each element in `collection` thru
|
|
12297
|
+
* `iteratee`. The iteratee is invoked with three arguments:
|
|
12298
|
+
* (value, index|key, collection).
|
|
12299
|
+
*
|
|
12300
|
+
* Many lodash methods are guarded to work as iteratees for methods like
|
|
12301
|
+
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
|
12302
|
+
*
|
|
12303
|
+
* The guarded methods are:
|
|
12304
|
+
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
|
12305
|
+
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
|
12306
|
+
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
|
12307
|
+
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
|
12308
|
+
*
|
|
12309
|
+
* @static
|
|
12310
|
+
* @memberOf _
|
|
12311
|
+
* @since 0.1.0
|
|
12312
|
+
* @category Collection
|
|
12313
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
12314
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
12315
|
+
* @returns {Array} Returns the new mapped array.
|
|
12316
|
+
* @example
|
|
12317
|
+
*
|
|
12318
|
+
* function square(n) {
|
|
12319
|
+
* return n * n;
|
|
12320
|
+
* }
|
|
12321
|
+
*
|
|
12322
|
+
* _.map([4, 8], square);
|
|
12323
|
+
* // => [16, 64]
|
|
12324
|
+
*
|
|
12325
|
+
* _.map({ 'a': 4, 'b': 8 }, square);
|
|
12326
|
+
* // => [16, 64] (iteration order is not guaranteed)
|
|
12327
|
+
*
|
|
12328
|
+
* var users = [
|
|
12329
|
+
* { 'user': 'barney' },
|
|
12330
|
+
* { 'user': 'fred' }
|
|
12331
|
+
* ];
|
|
12332
|
+
*
|
|
12333
|
+
* // The `_.property` iteratee shorthand.
|
|
12334
|
+
* _.map(users, 'user');
|
|
12335
|
+
* // => ['barney', 'fred']
|
|
12336
|
+
*/
|
|
12337
|
+
|
|
12338
|
+
function map(collection, iteratee) {
|
|
12339
|
+
var func = isArray(collection) ? arrayMap : baseMap;
|
|
12340
|
+
return func(collection, baseIteratee(iteratee));
|
|
12341
|
+
}
|
|
12342
|
+
|
|
12343
|
+
/**
|
|
12344
|
+
* Creates an object composed of the `object` properties `predicate` returns
|
|
12345
|
+
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
12346
|
+
*
|
|
12347
|
+
* @static
|
|
12348
|
+
* @memberOf _
|
|
12349
|
+
* @since 4.0.0
|
|
12350
|
+
* @category Object
|
|
12351
|
+
* @param {Object} object The source object.
|
|
12352
|
+
* @param {Function} [predicate=_.identity] The function invoked per property.
|
|
12353
|
+
* @returns {Object} Returns the new object.
|
|
12354
|
+
* @example
|
|
12355
|
+
*
|
|
12356
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
12357
|
+
*
|
|
12358
|
+
* _.pickBy(object, _.isNumber);
|
|
12359
|
+
* // => { 'a': 1, 'c': 3 }
|
|
12360
|
+
*/
|
|
12361
|
+
|
|
12362
|
+
function pickBy(object, predicate) {
|
|
12363
|
+
if (object == null) {
|
|
12364
|
+
return {};
|
|
12365
|
+
}
|
|
12366
|
+
|
|
12367
|
+
var props = arrayMap(getAllKeysIn(object), function (prop) {
|
|
12368
|
+
return [prop];
|
|
12369
|
+
});
|
|
12370
|
+
predicate = baseIteratee(predicate);
|
|
12371
|
+
return basePickBy(object, props, function (value, path) {
|
|
12372
|
+
return predicate(value, path[0]);
|
|
12373
|
+
});
|
|
12374
|
+
}
|
|
12375
|
+
|
|
11863
12376
|
function parseQueryString(value) {
|
|
11864
12377
|
var qs = value.split('&').reduce(function (acc, param) {
|
|
11865
12378
|
var _param$split = param.split('='),
|
|
@@ -11872,6 +12385,15 @@ function parseQueryString(value) {
|
|
|
11872
12385
|
}, {});
|
|
11873
12386
|
return camelCaseProperties(qs);
|
|
11874
12387
|
}
|
|
12388
|
+
function toQueryString(obj) {
|
|
12389
|
+
var snakeCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
12390
|
+
var params = snakeCase ? snakeCaseProperties(obj) : obj;
|
|
12391
|
+
return map(pickBy(params, function (v) {
|
|
12392
|
+
return v !== null && v !== undefined;
|
|
12393
|
+
}), function (value, key) {
|
|
12394
|
+
return value !== '' ? "".concat(key, "=").concat(encodeURIComponent(value)) : key;
|
|
12395
|
+
}).join('&');
|
|
12396
|
+
}
|
|
11875
12397
|
|
|
11876
12398
|
var MainView$2 = /*#__PURE__*/function (_React$Component) {
|
|
11877
12399
|
_inherits(MainView, _React$Component);
|
|
@@ -11994,7 +12516,7 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
11994
12516
|
|
|
11995
12517
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11996
12518
|
|
|
11997
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
12519
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11998
12520
|
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function (_) {
|
|
11999
12521
|
return data;
|
|
12000
12522
|
});
|
|
@@ -12008,8 +12530,15 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
12008
12530
|
}
|
|
12009
12531
|
|
|
12010
12532
|
_createClass(MainView, [{
|
|
12533
|
+
key: "componentDidMount",
|
|
12534
|
+
value: function componentDidMount() {
|
|
12535
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
12536
|
+
}
|
|
12537
|
+
}, {
|
|
12011
12538
|
key: "render",
|
|
12012
12539
|
value: function render() {
|
|
12540
|
+
var _this2 = this;
|
|
12541
|
+
|
|
12013
12542
|
var _this$props = this.props,
|
|
12014
12543
|
i18n = _this$props.i18n,
|
|
12015
12544
|
showSocialLogins = _this$props.showSocialLogins,
|
|
@@ -12024,10 +12553,14 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
12024
12553
|
}), showSocialLogins && socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(Separator, {
|
|
12025
12554
|
text: i18n('or')
|
|
12026
12555
|
}), isEmail && showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('passwordless.intro')), isEmail && /*#__PURE__*/React__default.createElement(EmailInputForm, {
|
|
12027
|
-
handler:
|
|
12556
|
+
handler: function handler(data) {
|
|
12557
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "passwordless_email");
|
|
12558
|
+
},
|
|
12028
12559
|
onSuccess: this.handleSuccess
|
|
12029
12560
|
}), !isEmail && showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('passwordless.sms.intro')), !isEmail && /*#__PURE__*/React__default.createElement(PhoneNumberInputForm, {
|
|
12030
|
-
handler:
|
|
12561
|
+
handler: function handler(data) {
|
|
12562
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "passwordless_phone");
|
|
12563
|
+
},
|
|
12031
12564
|
onSuccess: this.handleSuccess
|
|
12032
12565
|
}));
|
|
12033
12566
|
}
|
|
@@ -12042,7 +12575,7 @@ var VerificationCodeView$1 = /*#__PURE__*/function (_React$Component2) {
|
|
|
12042
12575
|
var _super2 = _createSuper(VerificationCodeView);
|
|
12043
12576
|
|
|
12044
12577
|
function VerificationCodeView() {
|
|
12045
|
-
var
|
|
12578
|
+
var _this3;
|
|
12046
12579
|
|
|
12047
12580
|
_classCallCheck(this, VerificationCodeView);
|
|
12048
12581
|
|
|
@@ -12050,26 +12583,30 @@ var VerificationCodeView$1 = /*#__PURE__*/function (_React$Component2) {
|
|
|
12050
12583
|
args[_key2] = arguments[_key2];
|
|
12051
12584
|
}
|
|
12052
12585
|
|
|
12053
|
-
|
|
12586
|
+
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
12054
12587
|
|
|
12055
|
-
_defineProperty(_assertThisInitialized(
|
|
12056
|
-
var
|
|
12057
|
-
apiClient =
|
|
12058
|
-
auth =
|
|
12059
|
-
phoneNumber =
|
|
12588
|
+
_defineProperty(_assertThisInitialized(_this3), "handleSubmit", function (data) {
|
|
12589
|
+
var _this3$props = _this3.props,
|
|
12590
|
+
apiClient = _this3$props.apiClient,
|
|
12591
|
+
auth = _this3$props.auth,
|
|
12592
|
+
phoneNumber = _this3$props.phoneNumber;
|
|
12060
12593
|
return apiClient.verifyPasswordless(_objectSpread2({
|
|
12061
12594
|
phoneNumber: phoneNumber
|
|
12062
12595
|
}, data), auth);
|
|
12063
12596
|
});
|
|
12064
12597
|
|
|
12065
|
-
return
|
|
12598
|
+
return _this3;
|
|
12066
12599
|
}
|
|
12067
12600
|
|
|
12068
12601
|
_createClass(VerificationCodeView, [{
|
|
12069
12602
|
key: "render",
|
|
12070
12603
|
value: function render() {
|
|
12604
|
+
var _this4 = this;
|
|
12605
|
+
|
|
12071
12606
|
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, {
|
|
12072
|
-
handler:
|
|
12607
|
+
handler: function handler(data) {
|
|
12608
|
+
return ReCaptcha.handle(data, _this4.props, _this4.callback, "verify_passwordless_sms");
|
|
12609
|
+
}
|
|
12073
12610
|
}));
|
|
12074
12611
|
}
|
|
12075
12612
|
}]);
|
|
@@ -15111,10 +15648,18 @@ function createClient(creationConfig) {
|
|
|
15111
15648
|
var client = coreClient.remoteSettings.then(function (remoteSettings) {
|
|
15112
15649
|
var remoteConfig = camelCaseProperties(remoteSettings);
|
|
15113
15650
|
var language = creationConfig.language || remoteConfig.language;
|
|
15114
|
-
return fetch("".concat(
|
|
15651
|
+
return fetch("https://".concat(creationConfig.domain, "/identity/v1/config/consents?").concat(toQueryString({
|
|
15652
|
+
lang: language
|
|
15653
|
+
}))).then(function (response) {
|
|
15115
15654
|
return response.json();
|
|
15116
|
-
}).then(function (
|
|
15117
|
-
return
|
|
15655
|
+
}).then(function (consentsVersions) {
|
|
15656
|
+
return fetch("".concat(remoteSettings.resourceBaseUrl, "/").concat(language, ".json")).then(function (response) {
|
|
15657
|
+
return response.json();
|
|
15658
|
+
}).then(function (defaultI18n) {
|
|
15659
|
+
return new UiClient(_objectSpread2(_objectSpread2(_objectSpread2({}, creationConfig), remoteConfig), {}, {
|
|
15660
|
+
consentsVersions: camelCaseProperties(consentsVersions)
|
|
15661
|
+
}), urlParser, coreClient, defaultI18n);
|
|
15662
|
+
})["catch"](console.error);
|
|
15118
15663
|
})["catch"](console.error);
|
|
15119
15664
|
});
|
|
15120
15665
|
return {
|