@panneau/form-auth 1.0.0-alpha.240 → 1.0.0-alpha.243
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/es/index.js +207 -31
- package/lib/index.js +209 -30
- package/package.json +5 -4
package/es/index.js
CHANGED
|
@@ -2,12 +2,64 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
import { PropTypes as PropTypes$1 } from '@panneau/core';
|
|
3
3
|
import Form from '@panneau/form';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
7
7
|
import { Link } from 'react-router-dom';
|
|
8
|
+
import { postJSON, getCSRFHeaders } from '@folklore/fetch';
|
|
8
9
|
|
|
9
|
-
var _excluded$
|
|
10
|
-
var propTypes$
|
|
10
|
+
var _excluded$7 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
|
|
11
|
+
var propTypes$7 = {
|
|
12
|
+
action: PropTypes.string,
|
|
13
|
+
fields: PropTypes$1.fields,
|
|
14
|
+
size: PropTypes.string,
|
|
15
|
+
passwordLabel: PropTypes$1.label,
|
|
16
|
+
submitButtonLabel: PropTypes$1.label
|
|
17
|
+
};
|
|
18
|
+
var defaultProps$7 = {
|
|
19
|
+
action: '/user/confirm-password',
|
|
20
|
+
fields: null,
|
|
21
|
+
size: 'lg',
|
|
22
|
+
passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
23
|
+
id: "B1h3gd",
|
|
24
|
+
defaultMessage: [{
|
|
25
|
+
"type": 0,
|
|
26
|
+
"value": "Please enter your password to continue"
|
|
27
|
+
}]
|
|
28
|
+
}),
|
|
29
|
+
submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
30
|
+
id: "QUAHwy",
|
|
31
|
+
defaultMessage: [{
|
|
32
|
+
"type": 0,
|
|
33
|
+
"value": "Continue"
|
|
34
|
+
}]
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var ConfirmPassword = function ConfirmPassword(_ref) {
|
|
39
|
+
var action = _ref.action,
|
|
40
|
+
fields = _ref.fields,
|
|
41
|
+
size = _ref.size,
|
|
42
|
+
passwordLabel = _ref.passwordLabel,
|
|
43
|
+
submitButtonLabel = _ref.submitButtonLabel,
|
|
44
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/React.createElement(Form, Object.assign({
|
|
47
|
+
action: action,
|
|
48
|
+
fields: fields || [{
|
|
49
|
+
name: 'password',
|
|
50
|
+
type: 'password',
|
|
51
|
+
size: size,
|
|
52
|
+
label: passwordLabel
|
|
53
|
+
}],
|
|
54
|
+
submitButtonLabel: submitButtonLabel
|
|
55
|
+
}, props));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
ConfirmPassword.propTypes = propTypes$7;
|
|
59
|
+
ConfirmPassword.defaultProps = defaultProps$7;
|
|
60
|
+
|
|
61
|
+
var _excluded$6 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
|
|
62
|
+
var propTypes$6 = {
|
|
11
63
|
action: PropTypes.string,
|
|
12
64
|
fields: PropTypes$1.fields,
|
|
13
65
|
size: PropTypes.string,
|
|
@@ -17,7 +69,7 @@ var propTypes$4 = {
|
|
|
17
69
|
loginLink: PropTypes.string,
|
|
18
70
|
loginLabel: PropTypes$1.label
|
|
19
71
|
};
|
|
20
|
-
var defaultProps$
|
|
72
|
+
var defaultProps$6 = {
|
|
21
73
|
action: '/forgot-password',
|
|
22
74
|
fields: null,
|
|
23
75
|
size: 'lg',
|
|
@@ -55,7 +107,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
|
|
|
55
107
|
withLoginLink = _ref.withLoginLink,
|
|
56
108
|
loginLink = _ref.loginLink,
|
|
57
109
|
loginLabel = _ref.loginLabel,
|
|
58
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
110
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
59
111
|
|
|
60
112
|
return /*#__PURE__*/React.createElement(Form, Object.assign({
|
|
61
113
|
action: action,
|
|
@@ -73,11 +125,11 @@ var ForgotPassword = function ForgotPassword(_ref) {
|
|
|
73
125
|
}, props));
|
|
74
126
|
};
|
|
75
127
|
|
|
76
|
-
ForgotPassword.propTypes = propTypes$
|
|
77
|
-
ForgotPassword.defaultProps = defaultProps$
|
|
128
|
+
ForgotPassword.propTypes = propTypes$6;
|
|
129
|
+
ForgotPassword.defaultProps = defaultProps$6;
|
|
78
130
|
|
|
79
|
-
var _excluded$
|
|
80
|
-
var propTypes$
|
|
131
|
+
var _excluded$5 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
|
|
132
|
+
var propTypes$5 = {
|
|
81
133
|
action: PropTypes.string,
|
|
82
134
|
fields: PropTypes$1.fields,
|
|
83
135
|
size: PropTypes.string,
|
|
@@ -88,7 +140,7 @@ var propTypes$3 = {
|
|
|
88
140
|
forgotPasswordLink: PropTypes.string,
|
|
89
141
|
forgotPasswordLabel: PropTypes$1.label
|
|
90
142
|
};
|
|
91
|
-
var defaultProps$
|
|
143
|
+
var defaultProps$5 = {
|
|
92
144
|
action: '/login',
|
|
93
145
|
fields: null,
|
|
94
146
|
size: 'lg',
|
|
@@ -134,7 +186,7 @@ var Login = function Login(_ref) {
|
|
|
134
186
|
withForgotPassword = _ref.withForgotPassword,
|
|
135
187
|
forgotPasswordLink = _ref.forgotPasswordLink,
|
|
136
188
|
forgotPasswordLabel = _ref.forgotPasswordLabel,
|
|
137
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
189
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
138
190
|
|
|
139
191
|
return /*#__PURE__*/React.createElement(Form, Object.assign({
|
|
140
192
|
action: action,
|
|
@@ -157,11 +209,11 @@ var Login = function Login(_ref) {
|
|
|
157
209
|
}, props));
|
|
158
210
|
};
|
|
159
211
|
|
|
160
|
-
Login.propTypes = propTypes$
|
|
161
|
-
Login.defaultProps = defaultProps$
|
|
212
|
+
Login.propTypes = propTypes$5;
|
|
213
|
+
Login.defaultProps = defaultProps$5;
|
|
162
214
|
|
|
163
|
-
var _excluded$
|
|
164
|
-
var propTypes$
|
|
215
|
+
var _excluded$4 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
|
|
216
|
+
var propTypes$4 = {
|
|
165
217
|
action: PropTypes.string,
|
|
166
218
|
fields: PropTypes$1.fields,
|
|
167
219
|
size: PropTypes.string,
|
|
@@ -174,8 +226,9 @@ var propTypes$2 = {
|
|
|
174
226
|
loginLink: PropTypes.string,
|
|
175
227
|
loginLabel: PropTypes$1.label
|
|
176
228
|
};
|
|
177
|
-
var defaultProps$
|
|
229
|
+
var defaultProps$4 = {
|
|
178
230
|
action: '/register',
|
|
231
|
+
// https://bold.media.test:8080/register
|
|
179
232
|
fields: null,
|
|
180
233
|
size: 'lg',
|
|
181
234
|
nameLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
@@ -236,7 +289,7 @@ var Register = function Register(_ref) {
|
|
|
236
289
|
withLoginLink = _ref.withLoginLink,
|
|
237
290
|
loginLink = _ref.loginLink,
|
|
238
291
|
loginLabel = _ref.loginLabel,
|
|
239
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
292
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
240
293
|
|
|
241
294
|
return /*#__PURE__*/React.createElement(Form, Object.assign({
|
|
242
295
|
action: action,
|
|
@@ -269,11 +322,11 @@ var Register = function Register(_ref) {
|
|
|
269
322
|
}, props));
|
|
270
323
|
};
|
|
271
324
|
|
|
272
|
-
Register.propTypes = propTypes$
|
|
273
|
-
Register.defaultProps = defaultProps$
|
|
325
|
+
Register.propTypes = propTypes$4;
|
|
326
|
+
Register.defaultProps = defaultProps$4;
|
|
274
327
|
|
|
275
|
-
var _excluded$
|
|
276
|
-
var propTypes$
|
|
328
|
+
var _excluded$3 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
|
|
329
|
+
var propTypes$3 = {
|
|
277
330
|
action: PropTypes.string,
|
|
278
331
|
fields: PropTypes$1.fields,
|
|
279
332
|
size: PropTypes.string,
|
|
@@ -281,7 +334,7 @@ var propTypes$1 = {
|
|
|
281
334
|
passwordConfirmationLabel: PropTypes$1.label,
|
|
282
335
|
submitButtonLabel: PropTypes$1.label
|
|
283
336
|
};
|
|
284
|
-
var defaultProps$
|
|
337
|
+
var defaultProps$3 = {
|
|
285
338
|
action: '/reset-password',
|
|
286
339
|
fields: null,
|
|
287
340
|
size: 'lg',
|
|
@@ -315,7 +368,7 @@ var ResetPassword = function ResetPassword(_ref) {
|
|
|
315
368
|
passwordLabel = _ref.passwordLabel,
|
|
316
369
|
passwordConfirmationLabel = _ref.passwordConfirmationLabel,
|
|
317
370
|
submitButtonLabel = _ref.submitButtonLabel,
|
|
318
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
371
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
319
372
|
|
|
320
373
|
return /*#__PURE__*/React.createElement(Form, Object.assign({
|
|
321
374
|
action: action,
|
|
@@ -334,8 +387,131 @@ var ResetPassword = function ResetPassword(_ref) {
|
|
|
334
387
|
}, props));
|
|
335
388
|
};
|
|
336
389
|
|
|
337
|
-
ResetPassword.propTypes = propTypes$
|
|
338
|
-
ResetPassword.defaultProps = defaultProps$
|
|
390
|
+
ResetPassword.propTypes = propTypes$3;
|
|
391
|
+
ResetPassword.defaultProps = defaultProps$3;
|
|
392
|
+
|
|
393
|
+
var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
|
|
394
|
+
var propTypes$2 = {
|
|
395
|
+
action: PropTypes.string,
|
|
396
|
+
fields: PropTypes$1.fields,
|
|
397
|
+
size: PropTypes.string,
|
|
398
|
+
codeLabel: PropTypes$1.label,
|
|
399
|
+
submitButtonLabel: PropTypes$1.label
|
|
400
|
+
};
|
|
401
|
+
var defaultProps$2 = {
|
|
402
|
+
action: '/two-factor-challenge',
|
|
403
|
+
fields: null,
|
|
404
|
+
size: 'lg',
|
|
405
|
+
codeLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
406
|
+
id: "22Ld5M",
|
|
407
|
+
defaultMessage: [{
|
|
408
|
+
"type": 0,
|
|
409
|
+
"value": "Enter the code from your authenticator app to continue"
|
|
410
|
+
}]
|
|
411
|
+
}),
|
|
412
|
+
submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
413
|
+
id: "QUAHwy",
|
|
414
|
+
defaultMessage: [{
|
|
415
|
+
"type": 0,
|
|
416
|
+
"value": "Continue"
|
|
417
|
+
}]
|
|
418
|
+
})
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
|
|
422
|
+
var action = _ref.action,
|
|
423
|
+
fields = _ref.fields,
|
|
424
|
+
size = _ref.size,
|
|
425
|
+
codeLabel = _ref.codeLabel,
|
|
426
|
+
submitButtonLabel = _ref.submitButtonLabel,
|
|
427
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
428
|
+
|
|
429
|
+
return /*#__PURE__*/React.createElement(Form, Object.assign({
|
|
430
|
+
action: action,
|
|
431
|
+
fields: fields || [{
|
|
432
|
+
name: 'code',
|
|
433
|
+
type: 'text',
|
|
434
|
+
size: size,
|
|
435
|
+
label: codeLabel
|
|
436
|
+
}],
|
|
437
|
+
submitButtonLabel: submitButtonLabel
|
|
438
|
+
}, props));
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
TwoFactorChallenge.propTypes = propTypes$2;
|
|
442
|
+
TwoFactorChallenge.defaultProps = defaultProps$2;
|
|
443
|
+
|
|
444
|
+
var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
|
|
445
|
+
var propTypes$1 = {
|
|
446
|
+
action: PropTypes.string,
|
|
447
|
+
fields: PropTypes$1.fields,
|
|
448
|
+
size: PropTypes.string,
|
|
449
|
+
explainationLabel: PropTypes$1.label,
|
|
450
|
+
submitButtonLabel: PropTypes$1.label,
|
|
451
|
+
withCancelLink: PropTypes.bool,
|
|
452
|
+
cancelLink: PropTypes.string,
|
|
453
|
+
cancelLabel: PropTypes$1.label
|
|
454
|
+
};
|
|
455
|
+
var defaultProps$1 = {
|
|
456
|
+
action: '/user/two-factor-authentication',
|
|
457
|
+
fields: null,
|
|
458
|
+
size: 'lg',
|
|
459
|
+
explainationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
460
|
+
id: "5nHK/H",
|
|
461
|
+
defaultMessage: [{
|
|
462
|
+
"type": 0,
|
|
463
|
+
"value": "Do you really wish to disable two factor authentication on your account?"
|
|
464
|
+
}]
|
|
465
|
+
}),
|
|
466
|
+
submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
467
|
+
id: "gWmL5V",
|
|
468
|
+
defaultMessage: [{
|
|
469
|
+
"type": 0,
|
|
470
|
+
"value": "Disable two factor authentication"
|
|
471
|
+
}]
|
|
472
|
+
}),
|
|
473
|
+
withCancelLink: true,
|
|
474
|
+
cancelLink: '/home',
|
|
475
|
+
cancelLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
476
|
+
id: "U/ye2x",
|
|
477
|
+
defaultMessage: [{
|
|
478
|
+
"type": 0,
|
|
479
|
+
"value": "Cancel"
|
|
480
|
+
}]
|
|
481
|
+
})
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
var TwoFactorDisable = function TwoFactorDisable(_ref) {
|
|
485
|
+
var action = _ref.action;
|
|
486
|
+
_ref.fields;
|
|
487
|
+
var explainationLabel = _ref.explainationLabel,
|
|
488
|
+
submitButtonLabel = _ref.submitButtonLabel;
|
|
489
|
+
_ref.size;
|
|
490
|
+
var withCancelLink = _ref.withCancelLink,
|
|
491
|
+
cancelLink = _ref.cancelLink,
|
|
492
|
+
cancelLabel = _ref.cancelLabel,
|
|
493
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
494
|
+
|
|
495
|
+
var defaultPostForm = useCallback(function (act, data) {
|
|
496
|
+
return postJSON(act, data, {
|
|
497
|
+
credentials: 'include',
|
|
498
|
+
headers: getCSRFHeaders(),
|
|
499
|
+
method: 'DELETE'
|
|
500
|
+
});
|
|
501
|
+
}, []);
|
|
502
|
+
return /*#__PURE__*/React.createElement(Form, Object.assign({
|
|
503
|
+
action: action,
|
|
504
|
+
submitButtonLabel: submitButtonLabel,
|
|
505
|
+
actions: withCancelLink ? /*#__PURE__*/React.createElement(Link, {
|
|
506
|
+
className: "py-2 px-4",
|
|
507
|
+
to: cancelLink
|
|
508
|
+
}, cancelLabel) : null,
|
|
509
|
+
postForm: defaultPostForm
|
|
510
|
+
}, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
TwoFactorDisable.propTypes = propTypes$1;
|
|
514
|
+
TwoFactorDisable.defaultProps = defaultProps$1;
|
|
339
515
|
|
|
340
516
|
var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
|
|
341
517
|
var propTypes = {
|
|
@@ -360,10 +536,10 @@ var defaultProps = {
|
|
|
360
536
|
}]
|
|
361
537
|
}),
|
|
362
538
|
submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
363
|
-
id: "
|
|
539
|
+
id: "pVHYDd",
|
|
364
540
|
defaultMessage: [{
|
|
365
541
|
"type": 0,
|
|
366
|
-
"value": "Enable
|
|
542
|
+
"value": "Enable two factor authentication"
|
|
367
543
|
}]
|
|
368
544
|
}),
|
|
369
545
|
withSkipLink: true,
|
|
@@ -377,7 +553,7 @@ var defaultProps = {
|
|
|
377
553
|
})
|
|
378
554
|
};
|
|
379
555
|
|
|
380
|
-
var
|
|
556
|
+
var TwoFactorEnable = function TwoFactorEnable(_ref) {
|
|
381
557
|
var action = _ref.action;
|
|
382
558
|
_ref.fields;
|
|
383
559
|
var explainationLabel = _ref.explainationLabel,
|
|
@@ -398,7 +574,7 @@ var TwoFactor = function TwoFactor(_ref) {
|
|
|
398
574
|
}, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
|
|
399
575
|
};
|
|
400
576
|
|
|
401
|
-
|
|
402
|
-
|
|
577
|
+
TwoFactorEnable.propTypes = propTypes;
|
|
578
|
+
TwoFactorEnable.defaultProps = defaultProps;
|
|
403
579
|
|
|
404
|
-
export { ForgotPassword, Login, Register, ResetPassword,
|
|
580
|
+
export { ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable };
|
package/lib/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var PropTypes = require('prop-types');
|
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var reactIntl = require('react-intl');
|
|
11
11
|
var reactRouterDom = require('react-router-dom');
|
|
12
|
+
var fetch = require('@folklore/fetch');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
15
|
|
|
@@ -17,8 +18,59 @@ var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
|
|
|
17
18
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
18
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
20
|
|
|
20
|
-
var _excluded$
|
|
21
|
-
var propTypes$
|
|
21
|
+
var _excluded$7 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
|
|
22
|
+
var propTypes$7 = {
|
|
23
|
+
action: PropTypes__default["default"].string,
|
|
24
|
+
fields: core.PropTypes.fields,
|
|
25
|
+
size: PropTypes__default["default"].string,
|
|
26
|
+
passwordLabel: core.PropTypes.label,
|
|
27
|
+
submitButtonLabel: core.PropTypes.label
|
|
28
|
+
};
|
|
29
|
+
var defaultProps$7 = {
|
|
30
|
+
action: '/user/confirm-password',
|
|
31
|
+
fields: null,
|
|
32
|
+
size: 'lg',
|
|
33
|
+
passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
34
|
+
id: "B1h3gd",
|
|
35
|
+
defaultMessage: [{
|
|
36
|
+
"type": 0,
|
|
37
|
+
"value": "Please enter your password to continue"
|
|
38
|
+
}]
|
|
39
|
+
}),
|
|
40
|
+
submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
41
|
+
id: "QUAHwy",
|
|
42
|
+
defaultMessage: [{
|
|
43
|
+
"type": 0,
|
|
44
|
+
"value": "Continue"
|
|
45
|
+
}]
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var ConfirmPassword = function ConfirmPassword(_ref) {
|
|
50
|
+
var action = _ref.action,
|
|
51
|
+
fields = _ref.fields,
|
|
52
|
+
size = _ref.size,
|
|
53
|
+
passwordLabel = _ref.passwordLabel,
|
|
54
|
+
submitButtonLabel = _ref.submitButtonLabel,
|
|
55
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$7);
|
|
56
|
+
|
|
57
|
+
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
|
|
58
|
+
action: action,
|
|
59
|
+
fields: fields || [{
|
|
60
|
+
name: 'password',
|
|
61
|
+
type: 'password',
|
|
62
|
+
size: size,
|
|
63
|
+
label: passwordLabel
|
|
64
|
+
}],
|
|
65
|
+
submitButtonLabel: submitButtonLabel
|
|
66
|
+
}, props));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
ConfirmPassword.propTypes = propTypes$7;
|
|
70
|
+
ConfirmPassword.defaultProps = defaultProps$7;
|
|
71
|
+
|
|
72
|
+
var _excluded$6 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
|
|
73
|
+
var propTypes$6 = {
|
|
22
74
|
action: PropTypes__default["default"].string,
|
|
23
75
|
fields: core.PropTypes.fields,
|
|
24
76
|
size: PropTypes__default["default"].string,
|
|
@@ -28,7 +80,7 @@ var propTypes$4 = {
|
|
|
28
80
|
loginLink: PropTypes__default["default"].string,
|
|
29
81
|
loginLabel: core.PropTypes.label
|
|
30
82
|
};
|
|
31
|
-
var defaultProps$
|
|
83
|
+
var defaultProps$6 = {
|
|
32
84
|
action: '/forgot-password',
|
|
33
85
|
fields: null,
|
|
34
86
|
size: 'lg',
|
|
@@ -66,7 +118,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
|
|
|
66
118
|
withLoginLink = _ref.withLoginLink,
|
|
67
119
|
loginLink = _ref.loginLink,
|
|
68
120
|
loginLabel = _ref.loginLabel,
|
|
69
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
121
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$6);
|
|
70
122
|
|
|
71
123
|
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
|
|
72
124
|
action: action,
|
|
@@ -84,11 +136,11 @@ var ForgotPassword = function ForgotPassword(_ref) {
|
|
|
84
136
|
}, props));
|
|
85
137
|
};
|
|
86
138
|
|
|
87
|
-
ForgotPassword.propTypes = propTypes$
|
|
88
|
-
ForgotPassword.defaultProps = defaultProps$
|
|
139
|
+
ForgotPassword.propTypes = propTypes$6;
|
|
140
|
+
ForgotPassword.defaultProps = defaultProps$6;
|
|
89
141
|
|
|
90
|
-
var _excluded$
|
|
91
|
-
var propTypes$
|
|
142
|
+
var _excluded$5 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
|
|
143
|
+
var propTypes$5 = {
|
|
92
144
|
action: PropTypes__default["default"].string,
|
|
93
145
|
fields: core.PropTypes.fields,
|
|
94
146
|
size: PropTypes__default["default"].string,
|
|
@@ -99,7 +151,7 @@ var propTypes$3 = {
|
|
|
99
151
|
forgotPasswordLink: PropTypes__default["default"].string,
|
|
100
152
|
forgotPasswordLabel: core.PropTypes.label
|
|
101
153
|
};
|
|
102
|
-
var defaultProps$
|
|
154
|
+
var defaultProps$5 = {
|
|
103
155
|
action: '/login',
|
|
104
156
|
fields: null,
|
|
105
157
|
size: 'lg',
|
|
@@ -145,7 +197,7 @@ var Login = function Login(_ref) {
|
|
|
145
197
|
withForgotPassword = _ref.withForgotPassword,
|
|
146
198
|
forgotPasswordLink = _ref.forgotPasswordLink,
|
|
147
199
|
forgotPasswordLabel = _ref.forgotPasswordLabel,
|
|
148
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
200
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$5);
|
|
149
201
|
|
|
150
202
|
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
|
|
151
203
|
action: action,
|
|
@@ -168,11 +220,11 @@ var Login = function Login(_ref) {
|
|
|
168
220
|
}, props));
|
|
169
221
|
};
|
|
170
222
|
|
|
171
|
-
Login.propTypes = propTypes$
|
|
172
|
-
Login.defaultProps = defaultProps$
|
|
223
|
+
Login.propTypes = propTypes$5;
|
|
224
|
+
Login.defaultProps = defaultProps$5;
|
|
173
225
|
|
|
174
|
-
var _excluded$
|
|
175
|
-
var propTypes$
|
|
226
|
+
var _excluded$4 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
|
|
227
|
+
var propTypes$4 = {
|
|
176
228
|
action: PropTypes__default["default"].string,
|
|
177
229
|
fields: core.PropTypes.fields,
|
|
178
230
|
size: PropTypes__default["default"].string,
|
|
@@ -185,8 +237,9 @@ var propTypes$2 = {
|
|
|
185
237
|
loginLink: PropTypes__default["default"].string,
|
|
186
238
|
loginLabel: core.PropTypes.label
|
|
187
239
|
};
|
|
188
|
-
var defaultProps$
|
|
240
|
+
var defaultProps$4 = {
|
|
189
241
|
action: '/register',
|
|
242
|
+
// https://bold.media.test:8080/register
|
|
190
243
|
fields: null,
|
|
191
244
|
size: 'lg',
|
|
192
245
|
nameLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
@@ -247,7 +300,7 @@ var Register = function Register(_ref) {
|
|
|
247
300
|
withLoginLink = _ref.withLoginLink,
|
|
248
301
|
loginLink = _ref.loginLink,
|
|
249
302
|
loginLabel = _ref.loginLabel,
|
|
250
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
303
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
|
|
251
304
|
|
|
252
305
|
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
|
|
253
306
|
action: action,
|
|
@@ -280,11 +333,11 @@ var Register = function Register(_ref) {
|
|
|
280
333
|
}, props));
|
|
281
334
|
};
|
|
282
335
|
|
|
283
|
-
Register.propTypes = propTypes$
|
|
284
|
-
Register.defaultProps = defaultProps$
|
|
336
|
+
Register.propTypes = propTypes$4;
|
|
337
|
+
Register.defaultProps = defaultProps$4;
|
|
285
338
|
|
|
286
|
-
var _excluded$
|
|
287
|
-
var propTypes$
|
|
339
|
+
var _excluded$3 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
|
|
340
|
+
var propTypes$3 = {
|
|
288
341
|
action: PropTypes__default["default"].string,
|
|
289
342
|
fields: core.PropTypes.fields,
|
|
290
343
|
size: PropTypes__default["default"].string,
|
|
@@ -292,7 +345,7 @@ var propTypes$1 = {
|
|
|
292
345
|
passwordConfirmationLabel: core.PropTypes.label,
|
|
293
346
|
submitButtonLabel: core.PropTypes.label
|
|
294
347
|
};
|
|
295
|
-
var defaultProps$
|
|
348
|
+
var defaultProps$3 = {
|
|
296
349
|
action: '/reset-password',
|
|
297
350
|
fields: null,
|
|
298
351
|
size: 'lg',
|
|
@@ -326,7 +379,7 @@ var ResetPassword = function ResetPassword(_ref) {
|
|
|
326
379
|
passwordLabel = _ref.passwordLabel,
|
|
327
380
|
passwordConfirmationLabel = _ref.passwordConfirmationLabel,
|
|
328
381
|
submitButtonLabel = _ref.submitButtonLabel,
|
|
329
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
382
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
|
|
330
383
|
|
|
331
384
|
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
|
|
332
385
|
action: action,
|
|
@@ -345,8 +398,131 @@ var ResetPassword = function ResetPassword(_ref) {
|
|
|
345
398
|
}, props));
|
|
346
399
|
};
|
|
347
400
|
|
|
348
|
-
ResetPassword.propTypes = propTypes$
|
|
349
|
-
ResetPassword.defaultProps = defaultProps$
|
|
401
|
+
ResetPassword.propTypes = propTypes$3;
|
|
402
|
+
ResetPassword.defaultProps = defaultProps$3;
|
|
403
|
+
|
|
404
|
+
var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
|
|
405
|
+
var propTypes$2 = {
|
|
406
|
+
action: PropTypes__default["default"].string,
|
|
407
|
+
fields: core.PropTypes.fields,
|
|
408
|
+
size: PropTypes__default["default"].string,
|
|
409
|
+
codeLabel: core.PropTypes.label,
|
|
410
|
+
submitButtonLabel: core.PropTypes.label
|
|
411
|
+
};
|
|
412
|
+
var defaultProps$2 = {
|
|
413
|
+
action: '/two-factor-challenge',
|
|
414
|
+
fields: null,
|
|
415
|
+
size: 'lg',
|
|
416
|
+
codeLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
417
|
+
id: "22Ld5M",
|
|
418
|
+
defaultMessage: [{
|
|
419
|
+
"type": 0,
|
|
420
|
+
"value": "Enter the code from your authenticator app to continue"
|
|
421
|
+
}]
|
|
422
|
+
}),
|
|
423
|
+
submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
424
|
+
id: "QUAHwy",
|
|
425
|
+
defaultMessage: [{
|
|
426
|
+
"type": 0,
|
|
427
|
+
"value": "Continue"
|
|
428
|
+
}]
|
|
429
|
+
})
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
|
|
433
|
+
var action = _ref.action,
|
|
434
|
+
fields = _ref.fields,
|
|
435
|
+
size = _ref.size,
|
|
436
|
+
codeLabel = _ref.codeLabel,
|
|
437
|
+
submitButtonLabel = _ref.submitButtonLabel,
|
|
438
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
|
|
439
|
+
|
|
440
|
+
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
|
|
441
|
+
action: action,
|
|
442
|
+
fields: fields || [{
|
|
443
|
+
name: 'code',
|
|
444
|
+
type: 'text',
|
|
445
|
+
size: size,
|
|
446
|
+
label: codeLabel
|
|
447
|
+
}],
|
|
448
|
+
submitButtonLabel: submitButtonLabel
|
|
449
|
+
}, props));
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
TwoFactorChallenge.propTypes = propTypes$2;
|
|
453
|
+
TwoFactorChallenge.defaultProps = defaultProps$2;
|
|
454
|
+
|
|
455
|
+
var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
|
|
456
|
+
var propTypes$1 = {
|
|
457
|
+
action: PropTypes__default["default"].string,
|
|
458
|
+
fields: core.PropTypes.fields,
|
|
459
|
+
size: PropTypes__default["default"].string,
|
|
460
|
+
explainationLabel: core.PropTypes.label,
|
|
461
|
+
submitButtonLabel: core.PropTypes.label,
|
|
462
|
+
withCancelLink: PropTypes__default["default"].bool,
|
|
463
|
+
cancelLink: PropTypes__default["default"].string,
|
|
464
|
+
cancelLabel: core.PropTypes.label
|
|
465
|
+
};
|
|
466
|
+
var defaultProps$1 = {
|
|
467
|
+
action: '/user/two-factor-authentication',
|
|
468
|
+
fields: null,
|
|
469
|
+
size: 'lg',
|
|
470
|
+
explainationLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
471
|
+
id: "5nHK/H",
|
|
472
|
+
defaultMessage: [{
|
|
473
|
+
"type": 0,
|
|
474
|
+
"value": "Do you really wish to disable two factor authentication on your account?"
|
|
475
|
+
}]
|
|
476
|
+
}),
|
|
477
|
+
submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
478
|
+
id: "gWmL5V",
|
|
479
|
+
defaultMessage: [{
|
|
480
|
+
"type": 0,
|
|
481
|
+
"value": "Disable two factor authentication"
|
|
482
|
+
}]
|
|
483
|
+
}),
|
|
484
|
+
withCancelLink: true,
|
|
485
|
+
cancelLink: '/home',
|
|
486
|
+
cancelLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
487
|
+
id: "U/ye2x",
|
|
488
|
+
defaultMessage: [{
|
|
489
|
+
"type": 0,
|
|
490
|
+
"value": "Cancel"
|
|
491
|
+
}]
|
|
492
|
+
})
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
var TwoFactorDisable = function TwoFactorDisable(_ref) {
|
|
496
|
+
var action = _ref.action;
|
|
497
|
+
_ref.fields;
|
|
498
|
+
var explainationLabel = _ref.explainationLabel,
|
|
499
|
+
submitButtonLabel = _ref.submitButtonLabel;
|
|
500
|
+
_ref.size;
|
|
501
|
+
var withCancelLink = _ref.withCancelLink,
|
|
502
|
+
cancelLink = _ref.cancelLink,
|
|
503
|
+
cancelLabel = _ref.cancelLabel,
|
|
504
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
|
|
505
|
+
|
|
506
|
+
var defaultPostForm = React.useCallback(function (act, data) {
|
|
507
|
+
return fetch.postJSON(act, data, {
|
|
508
|
+
credentials: 'include',
|
|
509
|
+
headers: fetch.getCSRFHeaders(),
|
|
510
|
+
method: 'DELETE'
|
|
511
|
+
});
|
|
512
|
+
}, []);
|
|
513
|
+
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
|
|
514
|
+
action: action,
|
|
515
|
+
submitButtonLabel: submitButtonLabel,
|
|
516
|
+
actions: withCancelLink ? /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
|
|
517
|
+
className: "py-2 px-4",
|
|
518
|
+
to: cancelLink
|
|
519
|
+
}, cancelLabel) : null,
|
|
520
|
+
postForm: defaultPostForm
|
|
521
|
+
}, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
TwoFactorDisable.propTypes = propTypes$1;
|
|
525
|
+
TwoFactorDisable.defaultProps = defaultProps$1;
|
|
350
526
|
|
|
351
527
|
var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
|
|
352
528
|
var propTypes = {
|
|
@@ -371,10 +547,10 @@ var defaultProps = {
|
|
|
371
547
|
}]
|
|
372
548
|
}),
|
|
373
549
|
submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
374
|
-
id: "
|
|
550
|
+
id: "pVHYDd",
|
|
375
551
|
defaultMessage: [{
|
|
376
552
|
"type": 0,
|
|
377
|
-
"value": "Enable
|
|
553
|
+
"value": "Enable two factor authentication"
|
|
378
554
|
}]
|
|
379
555
|
}),
|
|
380
556
|
withSkipLink: true,
|
|
@@ -388,7 +564,7 @@ var defaultProps = {
|
|
|
388
564
|
})
|
|
389
565
|
};
|
|
390
566
|
|
|
391
|
-
var
|
|
567
|
+
var TwoFactorEnable = function TwoFactorEnable(_ref) {
|
|
392
568
|
var action = _ref.action;
|
|
393
569
|
_ref.fields;
|
|
394
570
|
var explainationLabel = _ref.explainationLabel,
|
|
@@ -409,11 +585,14 @@ var TwoFactor = function TwoFactor(_ref) {
|
|
|
409
585
|
}, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
|
|
410
586
|
};
|
|
411
587
|
|
|
412
|
-
|
|
413
|
-
|
|
588
|
+
TwoFactorEnable.propTypes = propTypes;
|
|
589
|
+
TwoFactorEnable.defaultProps = defaultProps;
|
|
414
590
|
|
|
591
|
+
exports.ConfirmPassword = ConfirmPassword;
|
|
415
592
|
exports.ForgotPassword = ForgotPassword;
|
|
416
593
|
exports.Login = Login;
|
|
417
594
|
exports.Register = Register;
|
|
418
595
|
exports.ResetPassword = ResetPassword;
|
|
419
|
-
exports.
|
|
596
|
+
exports.TwoFactorChallenge = TwoFactorChallenge;
|
|
597
|
+
exports.TwoFactorDisable = TwoFactorDisable;
|
|
598
|
+
exports.TwoFactorEnable = TwoFactorEnable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/form-auth",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.243",
|
|
4
4
|
"description": "Basic forgot password form",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -46,8 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/runtime": "^7.12.5",
|
|
49
|
-
"@
|
|
50
|
-
"@panneau/
|
|
49
|
+
"@folklore/fetch": "^0.1.15",
|
|
50
|
+
"@panneau/core": "^1.0.0-alpha.242",
|
|
51
|
+
"@panneau/form": "^1.0.0-alpha.242",
|
|
51
52
|
"classnames": "^2.2.6",
|
|
52
53
|
"lodash": "^4.17.21",
|
|
53
54
|
"prop-types": "^15.7.2",
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "9703e84a7d27cfc0024e95e7f82da20d1637079a"
|
|
61
62
|
}
|