@panneau/form-auth 1.0.0-alpha.246 → 1.0.0-alpha.249

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.
Files changed (3) hide show
  1. package/es/index.js +144 -129
  2. package/lib/index.js +144 -129
  3. package/package.json +2 -2
package/es/index.js CHANGED
@@ -7,15 +7,95 @@ import { FormattedMessage } from 'react-intl';
7
7
  import { Link } from 'react-router-dom';
8
8
  import { postJSON, getCSRFHeaders } from '@folklore/fetch';
9
9
 
10
- var _excluded$8 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
10
+ var _excluded$8 = ["action", "fields", "size", "currentPasswordLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
11
11
  var propTypes$8 = {
12
12
  action: PropTypes.string,
13
13
  fields: PropTypes$1.fields,
14
14
  size: PropTypes.string,
15
+ currentPasswordLabel: PropTypes$1.label,
15
16
  passwordLabel: PropTypes$1.label,
17
+ passwordConfirmationLabel: PropTypes$1.label,
16
18
  submitButtonLabel: PropTypes$1.label
17
19
  };
18
20
  var defaultProps$8 = {
21
+ action: '/user/password',
22
+ fields: null,
23
+ size: 'lg',
24
+ currentPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
25
+ id: "8LSb8C",
26
+ defaultMessage: [{
27
+ "type": 0,
28
+ "value": "Current password"
29
+ }]
30
+ }),
31
+ passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
32
+ id: "XJ1dc3",
33
+ defaultMessage: [{
34
+ "type": 0,
35
+ "value": "New password"
36
+ }]
37
+ }),
38
+ passwordConfirmationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
39
+ id: "DUbv+u",
40
+ defaultMessage: [{
41
+ "type": 0,
42
+ "value": "Confirm your new password"
43
+ }]
44
+ }),
45
+ submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
46
+ id: "XW9IKQ",
47
+ defaultMessage: [{
48
+ "type": 0,
49
+ "value": "Update password"
50
+ }]
51
+ })
52
+ };
53
+
54
+ var ChangePassword = function ChangePassword(_ref) {
55
+ var action = _ref.action,
56
+ fields = _ref.fields,
57
+ size = _ref.size,
58
+ currentPasswordLabel = _ref.currentPasswordLabel,
59
+ passwordLabel = _ref.passwordLabel,
60
+ passwordConfirmationLabel = _ref.passwordConfirmationLabel,
61
+ submitButtonLabel = _ref.submitButtonLabel,
62
+ props = _objectWithoutProperties(_ref, _excluded$8);
63
+
64
+ return /*#__PURE__*/React.createElement(Form, Object.assign({
65
+ action: action,
66
+ method: "PUT",
67
+ fields: fields || [{
68
+ name: 'current_password',
69
+ type: 'password',
70
+ size: size,
71
+ label: currentPasswordLabel
72
+ }, {
73
+ name: 'password',
74
+ type: 'password',
75
+ size: size,
76
+ label: passwordLabel
77
+ }, {
78
+ name: 'password_confirmation',
79
+ type: 'password',
80
+ size: size,
81
+ label: passwordConfirmationLabel
82
+ }],
83
+ submitButtonLabel: submitButtonLabel
84
+ }, props));
85
+ };
86
+
87
+ ChangePassword.propTypes = propTypes$8;
88
+ ChangePassword.defaultProps = defaultProps$8;
89
+
90
+ var _excluded$7 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
91
+ var propTypes$7 = {
92
+ action: PropTypes.string,
93
+ fields: PropTypes$1.fields,
94
+ size: PropTypes.string,
95
+ passwordLabel: PropTypes$1.label,
96
+ submitButtonLabel: PropTypes$1.label
97
+ };
98
+ var defaultProps$7 = {
19
99
  action: '/user/confirm-password',
20
100
  fields: null,
21
101
  size: 'lg',
@@ -41,7 +121,7 @@ var ConfirmPassword = function ConfirmPassword(_ref) {
41
121
  size = _ref.size,
42
122
  passwordLabel = _ref.passwordLabel,
43
123
  submitButtonLabel = _ref.submitButtonLabel,
44
- props = _objectWithoutProperties(_ref, _excluded$8);
124
+ props = _objectWithoutProperties(_ref, _excluded$7);
45
125
 
46
126
  return /*#__PURE__*/React.createElement(Form, Object.assign({
47
127
  action: action,
@@ -55,11 +135,11 @@ var ConfirmPassword = function ConfirmPassword(_ref) {
55
135
  }, props));
56
136
  };
57
137
 
58
- ConfirmPassword.propTypes = propTypes$8;
59
- ConfirmPassword.defaultProps = defaultProps$8;
138
+ ConfirmPassword.propTypes = propTypes$7;
139
+ ConfirmPassword.defaultProps = defaultProps$7;
60
140
 
61
- var _excluded$7 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
62
- var propTypes$7 = {
141
+ var _excluded$6 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
142
+ var propTypes$6 = {
63
143
  action: PropTypes.string,
64
144
  fields: PropTypes$1.fields,
65
145
  size: PropTypes.string,
@@ -69,7 +149,7 @@ var propTypes$7 = {
69
149
  loginLink: PropTypes.string,
70
150
  loginLabel: PropTypes$1.label
71
151
  };
72
- var defaultProps$7 = {
152
+ var defaultProps$6 = {
73
153
  action: '/forgot-password',
74
154
  fields: null,
75
155
  size: 'lg',
@@ -107,7 +187,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
107
187
  withLoginLink = _ref.withLoginLink,
108
188
  loginLink = _ref.loginLink,
109
189
  loginLabel = _ref.loginLabel,
110
- props = _objectWithoutProperties(_ref, _excluded$7);
190
+ props = _objectWithoutProperties(_ref, _excluded$6);
111
191
 
112
192
  return /*#__PURE__*/React.createElement(Form, Object.assign({
113
193
  action: action,
@@ -125,11 +205,11 @@ var ForgotPassword = function ForgotPassword(_ref) {
125
205
  }, props));
126
206
  };
127
207
 
128
- ForgotPassword.propTypes = propTypes$7;
129
- ForgotPassword.defaultProps = defaultProps$7;
208
+ ForgotPassword.propTypes = propTypes$6;
209
+ ForgotPassword.defaultProps = defaultProps$6;
130
210
 
131
- var _excluded$6 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
132
- var propTypes$6 = {
211
+ var _excluded$5 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
212
+ var propTypes$5 = {
133
213
  action: PropTypes.string,
134
214
  fields: PropTypes$1.fields,
135
215
  size: PropTypes.string,
@@ -140,7 +220,7 @@ var propTypes$6 = {
140
220
  forgotPasswordLink: PropTypes.string,
141
221
  forgotPasswordLabel: PropTypes$1.label
142
222
  };
143
- var defaultProps$6 = {
223
+ var defaultProps$5 = {
144
224
  action: '/login',
145
225
  fields: null,
146
226
  size: 'lg',
@@ -186,7 +266,7 @@ var Login = function Login(_ref) {
186
266
  withForgotPassword = _ref.withForgotPassword,
187
267
  forgotPasswordLink = _ref.forgotPasswordLink,
188
268
  forgotPasswordLabel = _ref.forgotPasswordLabel,
189
- props = _objectWithoutProperties(_ref, _excluded$6);
269
+ props = _objectWithoutProperties(_ref, _excluded$5);
190
270
 
191
271
  return /*#__PURE__*/React.createElement(Form, Object.assign({
192
272
  action: action,
@@ -209,11 +289,11 @@ var Login = function Login(_ref) {
209
289
  }, props));
210
290
  };
211
291
 
212
- Login.propTypes = propTypes$6;
213
- Login.defaultProps = defaultProps$6;
292
+ Login.propTypes = propTypes$5;
293
+ Login.defaultProps = defaultProps$5;
214
294
 
215
- var _excluded$5 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
216
- var propTypes$5 = {
295
+ var _excluded$4 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
296
+ var propTypes$4 = {
217
297
  action: PropTypes.string,
218
298
  fields: PropTypes$1.fields,
219
299
  size: PropTypes.string,
@@ -226,7 +306,7 @@ var propTypes$5 = {
226
306
  loginLink: PropTypes.string,
227
307
  loginLabel: PropTypes$1.label
228
308
  };
229
- var defaultProps$5 = {
309
+ var defaultProps$4 = {
230
310
  action: '/register',
231
311
  fields: null,
232
312
  size: 'lg',
@@ -266,7 +346,7 @@ var defaultProps$5 = {
266
346
  }]
267
347
  }),
268
348
  withLoginLink: true,
269
- loginLink: '/forgot-password',
349
+ loginLink: '/login',
270
350
  loginLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
271
351
  id: "wa783M",
272
352
  defaultMessage: [{
@@ -288,7 +368,7 @@ var Register = function Register(_ref) {
288
368
  withLoginLink = _ref.withLoginLink,
289
369
  loginLink = _ref.loginLink,
290
370
  loginLabel = _ref.loginLabel,
291
- props = _objectWithoutProperties(_ref, _excluded$5);
371
+ props = _objectWithoutProperties(_ref, _excluded$4);
292
372
 
293
373
  return /*#__PURE__*/React.createElement(Form, Object.assign({
294
374
  action: action,
@@ -321,22 +401,30 @@ var Register = function Register(_ref) {
321
401
  }, props));
322
402
  };
323
403
 
324
- Register.propTypes = propTypes$5;
325
- Register.defaultProps = defaultProps$5;
404
+ Register.propTypes = propTypes$4;
405
+ Register.defaultProps = defaultProps$4;
326
406
 
327
- var _excluded$4 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
328
- var propTypes$4 = {
407
+ var _excluded$3 = ["action", "fields", "size", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
408
+ var propTypes$3 = {
329
409
  action: PropTypes.string,
330
410
  fields: PropTypes$1.fields,
331
411
  size: PropTypes.string,
412
+ emailLabel: PropTypes$1.label,
332
413
  passwordLabel: PropTypes$1.label,
333
414
  passwordConfirmationLabel: PropTypes$1.label,
334
415
  submitButtonLabel: PropTypes$1.label
335
416
  };
336
- var defaultProps$4 = {
417
+ var defaultProps$3 = {
337
418
  action: '/reset-password',
338
419
  fields: null,
339
420
  size: 'lg',
421
+ emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
422
+ id: "LI0Gz4",
423
+ defaultMessage: [{
424
+ "type": 0,
425
+ "value": "Email"
426
+ }]
427
+ }),
340
428
  passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
341
429
  id: "4yfet+",
342
430
  defaultMessage: [{
@@ -364,20 +452,27 @@ var ResetPassword = function ResetPassword(_ref) {
364
452
  var action = _ref.action,
365
453
  fields = _ref.fields,
366
454
  size = _ref.size,
455
+ emailLabel = _ref.emailLabel,
367
456
  passwordLabel = _ref.passwordLabel,
368
457
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
369
458
  submitButtonLabel = _ref.submitButtonLabel,
370
- props = _objectWithoutProperties(_ref, _excluded$4);
459
+ props = _objectWithoutProperties(_ref, _excluded$3);
371
460
 
372
461
  return /*#__PURE__*/React.createElement(Form, Object.assign({
373
462
  action: action,
374
463
  fields: fields || [{
464
+ name: 'email',
465
+ type: 'email',
466
+ size: size,
467
+ label: emailLabel,
468
+ readOnly: true
469
+ }, {
375
470
  name: 'password',
376
471
  type: 'password',
377
472
  size: size,
378
473
  label: passwordLabel
379
474
  }, {
380
- name: 'password_confrmation',
475
+ name: 'password_confirmation',
381
476
  type: 'password',
382
477
  size: size,
383
478
  label: passwordConfirmationLabel
@@ -386,18 +481,18 @@ var ResetPassword = function ResetPassword(_ref) {
386
481
  }, props));
387
482
  };
388
483
 
389
- ResetPassword.propTypes = propTypes$4;
390
- ResetPassword.defaultProps = defaultProps$4;
484
+ ResetPassword.propTypes = propTypes$3;
485
+ ResetPassword.defaultProps = defaultProps$3;
391
486
 
392
- var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
393
- var propTypes$3 = {
487
+ var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
488
+ var propTypes$2 = {
394
489
  action: PropTypes.string,
395
490
  fields: PropTypes$1.fields,
396
491
  size: PropTypes.string,
397
492
  codeLabel: PropTypes$1.label,
398
493
  submitButtonLabel: PropTypes$1.label
399
494
  };
400
- var defaultProps$3 = {
495
+ var defaultProps$2 = {
401
496
  action: '/two-factor-challenge',
402
497
  fields: null,
403
498
  size: 'lg',
@@ -423,7 +518,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
423
518
  size = _ref.size,
424
519
  codeLabel = _ref.codeLabel,
425
520
  submitButtonLabel = _ref.submitButtonLabel,
426
- props = _objectWithoutProperties(_ref, _excluded$3);
521
+ props = _objectWithoutProperties(_ref, _excluded$2);
427
522
 
428
523
  return /*#__PURE__*/React.createElement(Form, Object.assign({
429
524
  action: action,
@@ -437,11 +532,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
437
532
  }, props));
438
533
  };
439
534
 
440
- TwoFactorChallenge.propTypes = propTypes$3;
441
- TwoFactorChallenge.defaultProps = defaultProps$3;
535
+ TwoFactorChallenge.propTypes = propTypes$2;
536
+ TwoFactorChallenge.defaultProps = defaultProps$2;
442
537
 
443
- var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
444
- var propTypes$2 = {
538
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
539
+ var propTypes$1 = {
445
540
  action: PropTypes.string,
446
541
  fields: PropTypes$1.fields,
447
542
  size: PropTypes.string,
@@ -451,7 +546,7 @@ var propTypes$2 = {
451
546
  cancelLink: PropTypes.string,
452
547
  cancelLabel: PropTypes$1.label
453
548
  };
454
- var defaultProps$2 = {
549
+ var defaultProps$1 = {
455
550
  action: '/user/two-factor-authentication',
456
551
  fields: null,
457
552
  size: 'lg',
@@ -489,7 +584,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
489
584
  var withCancelLink = _ref.withCancelLink,
490
585
  cancelLink = _ref.cancelLink,
491
586
  cancelLabel = _ref.cancelLabel,
492
- props = _objectWithoutProperties(_ref, _excluded$2);
587
+ props = _objectWithoutProperties(_ref, _excluded$1);
493
588
 
494
589
  var defaultPostForm = useCallback(function (act, data) {
495
590
  return postJSON(act, data, {
@@ -509,11 +604,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
509
604
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
510
605
  };
511
606
 
512
- TwoFactorDisable.propTypes = propTypes$2;
513
- TwoFactorDisable.defaultProps = defaultProps$2;
607
+ TwoFactorDisable.propTypes = propTypes$1;
608
+ TwoFactorDisable.defaultProps = defaultProps$1;
514
609
 
515
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
516
- var propTypes$1 = {
610
+ var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
611
+ var propTypes = {
517
612
  action: PropTypes.string,
518
613
  fields: PropTypes$1.fields,
519
614
  size: PropTypes.string,
@@ -523,7 +618,7 @@ var propTypes$1 = {
523
618
  skipLink: PropTypes.string,
524
619
  skipLabel: PropTypes$1.label
525
620
  };
526
- var defaultProps$1 = {
621
+ var defaultProps = {
527
622
  action: '/user/two-factor-authentication',
528
623
  fields: null,
529
624
  size: 'lg',
@@ -561,7 +656,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
561
656
  var withSkipLink = _ref.withSkipLink,
562
657
  skipLink = _ref.skipLink,
563
658
  skipLabel = _ref.skipLabel,
564
- props = _objectWithoutProperties(_ref, _excluded$1);
659
+ props = _objectWithoutProperties(_ref, _excluded);
565
660
 
566
661
  return /*#__PURE__*/React.createElement(Form, Object.assign({
567
662
  action: action,
@@ -573,87 +668,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
573
668
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
574
669
  };
575
670
 
576
- TwoFactorEnable.propTypes = propTypes$1;
577
- TwoFactorEnable.defaultProps = defaultProps$1;
578
-
579
- var _excluded = ["action", "fields", "size", "currentPasswordLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
580
- var propTypes = {
581
- action: PropTypes.string,
582
- fields: PropTypes$1.fields,
583
- size: PropTypes.string,
584
- currentPasswordLabel: PropTypes$1.label,
585
- passwordLabel: PropTypes$1.label,
586
- passwordConfirmationLabel: PropTypes$1.label,
587
- submitButtonLabel: PropTypes$1.label
588
- };
589
- var defaultProps = {
590
- action: '/user/password',
591
- fields: null,
592
- size: 'lg',
593
- currentPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
594
- id: "8LSb8C",
595
- defaultMessage: [{
596
- "type": 0,
597
- "value": "Current password"
598
- }]
599
- }),
600
- passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
601
- id: "4yfet+",
602
- defaultMessage: [{
603
- "type": 0,
604
- "value": "Password"
605
- }]
606
- }),
607
- passwordConfirmationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
608
- id: "VhJUeW",
609
- defaultMessage: [{
610
- "type": 0,
611
- "value": "Confirm your password"
612
- }]
613
- }),
614
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
615
- id: "XW9IKQ",
616
- defaultMessage: [{
617
- "type": 0,
618
- "value": "Update password"
619
- }]
620
- })
621
- };
622
-
623
- var UpdatePassword = function UpdatePassword(_ref) {
624
- var action = _ref.action,
625
- fields = _ref.fields,
626
- size = _ref.size,
627
- currentPasswordLabel = _ref.currentPasswordLabel,
628
- passwordLabel = _ref.passwordLabel,
629
- passwordConfirmationLabel = _ref.passwordConfirmationLabel,
630
- submitButtonLabel = _ref.submitButtonLabel,
631
- props = _objectWithoutProperties(_ref, _excluded);
632
-
633
- return /*#__PURE__*/React.createElement(Form, Object.assign({
634
- action: action,
635
- method: "PUT",
636
- fields: fields || [{
637
- name: 'current_password',
638
- type: 'password',
639
- size: size,
640
- label: currentPasswordLabel
641
- }, {
642
- name: 'password',
643
- type: 'password',
644
- size: size,
645
- label: passwordLabel
646
- }, {
647
- name: 'password_confrmation',
648
- type: 'password',
649
- size: size,
650
- label: passwordConfirmationLabel
651
- }],
652
- submitButtonLabel: submitButtonLabel
653
- }, props));
654
- };
655
-
656
- UpdatePassword.propTypes = propTypes;
657
- UpdatePassword.defaultProps = defaultProps;
671
+ TwoFactorEnable.propTypes = propTypes;
672
+ TwoFactorEnable.defaultProps = defaultProps;
658
673
 
659
- export { ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable, UpdatePassword };
674
+ export { ChangePassword, ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable };
package/lib/index.js CHANGED
@@ -18,15 +18,95 @@ var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
18
18
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
19
19
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
20
 
21
- var _excluded$8 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
21
+ var _excluded$8 = ["action", "fields", "size", "currentPasswordLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
22
22
  var propTypes$8 = {
23
23
  action: PropTypes__default["default"].string,
24
24
  fields: core.PropTypes.fields,
25
25
  size: PropTypes__default["default"].string,
26
+ currentPasswordLabel: core.PropTypes.label,
26
27
  passwordLabel: core.PropTypes.label,
28
+ passwordConfirmationLabel: core.PropTypes.label,
27
29
  submitButtonLabel: core.PropTypes.label
28
30
  };
29
31
  var defaultProps$8 = {
32
+ action: '/user/password',
33
+ fields: null,
34
+ size: 'lg',
35
+ currentPasswordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
36
+ id: "8LSb8C",
37
+ defaultMessage: [{
38
+ "type": 0,
39
+ "value": "Current password"
40
+ }]
41
+ }),
42
+ passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
43
+ id: "XJ1dc3",
44
+ defaultMessage: [{
45
+ "type": 0,
46
+ "value": "New password"
47
+ }]
48
+ }),
49
+ passwordConfirmationLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
50
+ id: "DUbv+u",
51
+ defaultMessage: [{
52
+ "type": 0,
53
+ "value": "Confirm your new password"
54
+ }]
55
+ }),
56
+ submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
57
+ id: "XW9IKQ",
58
+ defaultMessage: [{
59
+ "type": 0,
60
+ "value": "Update password"
61
+ }]
62
+ })
63
+ };
64
+
65
+ var ChangePassword = function ChangePassword(_ref) {
66
+ var action = _ref.action,
67
+ fields = _ref.fields,
68
+ size = _ref.size,
69
+ currentPasswordLabel = _ref.currentPasswordLabel,
70
+ passwordLabel = _ref.passwordLabel,
71
+ passwordConfirmationLabel = _ref.passwordConfirmationLabel,
72
+ submitButtonLabel = _ref.submitButtonLabel,
73
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$8);
74
+
75
+ return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
76
+ action: action,
77
+ method: "PUT",
78
+ fields: fields || [{
79
+ name: 'current_password',
80
+ type: 'password',
81
+ size: size,
82
+ label: currentPasswordLabel
83
+ }, {
84
+ name: 'password',
85
+ type: 'password',
86
+ size: size,
87
+ label: passwordLabel
88
+ }, {
89
+ name: 'password_confirmation',
90
+ type: 'password',
91
+ size: size,
92
+ label: passwordConfirmationLabel
93
+ }],
94
+ submitButtonLabel: submitButtonLabel
95
+ }, props));
96
+ };
97
+
98
+ ChangePassword.propTypes = propTypes$8;
99
+ ChangePassword.defaultProps = defaultProps$8;
100
+
101
+ var _excluded$7 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
102
+ var propTypes$7 = {
103
+ action: PropTypes__default["default"].string,
104
+ fields: core.PropTypes.fields,
105
+ size: PropTypes__default["default"].string,
106
+ passwordLabel: core.PropTypes.label,
107
+ submitButtonLabel: core.PropTypes.label
108
+ };
109
+ var defaultProps$7 = {
30
110
  action: '/user/confirm-password',
31
111
  fields: null,
32
112
  size: 'lg',
@@ -52,7 +132,7 @@ var ConfirmPassword = function ConfirmPassword(_ref) {
52
132
  size = _ref.size,
53
133
  passwordLabel = _ref.passwordLabel,
54
134
  submitButtonLabel = _ref.submitButtonLabel,
55
- props = _objectWithoutProperties__default["default"](_ref, _excluded$8);
135
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$7);
56
136
 
57
137
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
58
138
  action: action,
@@ -66,11 +146,11 @@ var ConfirmPassword = function ConfirmPassword(_ref) {
66
146
  }, props));
67
147
  };
68
148
 
69
- ConfirmPassword.propTypes = propTypes$8;
70
- ConfirmPassword.defaultProps = defaultProps$8;
149
+ ConfirmPassword.propTypes = propTypes$7;
150
+ ConfirmPassword.defaultProps = defaultProps$7;
71
151
 
72
- var _excluded$7 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
73
- var propTypes$7 = {
152
+ var _excluded$6 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
153
+ var propTypes$6 = {
74
154
  action: PropTypes__default["default"].string,
75
155
  fields: core.PropTypes.fields,
76
156
  size: PropTypes__default["default"].string,
@@ -80,7 +160,7 @@ var propTypes$7 = {
80
160
  loginLink: PropTypes__default["default"].string,
81
161
  loginLabel: core.PropTypes.label
82
162
  };
83
- var defaultProps$7 = {
163
+ var defaultProps$6 = {
84
164
  action: '/forgot-password',
85
165
  fields: null,
86
166
  size: 'lg',
@@ -118,7 +198,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
118
198
  withLoginLink = _ref.withLoginLink,
119
199
  loginLink = _ref.loginLink,
120
200
  loginLabel = _ref.loginLabel,
121
- props = _objectWithoutProperties__default["default"](_ref, _excluded$7);
201
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$6);
122
202
 
123
203
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
124
204
  action: action,
@@ -136,11 +216,11 @@ var ForgotPassword = function ForgotPassword(_ref) {
136
216
  }, props));
137
217
  };
138
218
 
139
- ForgotPassword.propTypes = propTypes$7;
140
- ForgotPassword.defaultProps = defaultProps$7;
219
+ ForgotPassword.propTypes = propTypes$6;
220
+ ForgotPassword.defaultProps = defaultProps$6;
141
221
 
142
- var _excluded$6 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
143
- var propTypes$6 = {
222
+ var _excluded$5 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
223
+ var propTypes$5 = {
144
224
  action: PropTypes__default["default"].string,
145
225
  fields: core.PropTypes.fields,
146
226
  size: PropTypes__default["default"].string,
@@ -151,7 +231,7 @@ var propTypes$6 = {
151
231
  forgotPasswordLink: PropTypes__default["default"].string,
152
232
  forgotPasswordLabel: core.PropTypes.label
153
233
  };
154
- var defaultProps$6 = {
234
+ var defaultProps$5 = {
155
235
  action: '/login',
156
236
  fields: null,
157
237
  size: 'lg',
@@ -197,7 +277,7 @@ var Login = function Login(_ref) {
197
277
  withForgotPassword = _ref.withForgotPassword,
198
278
  forgotPasswordLink = _ref.forgotPasswordLink,
199
279
  forgotPasswordLabel = _ref.forgotPasswordLabel,
200
- props = _objectWithoutProperties__default["default"](_ref, _excluded$6);
280
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$5);
201
281
 
202
282
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
203
283
  action: action,
@@ -220,11 +300,11 @@ var Login = function Login(_ref) {
220
300
  }, props));
221
301
  };
222
302
 
223
- Login.propTypes = propTypes$6;
224
- Login.defaultProps = defaultProps$6;
303
+ Login.propTypes = propTypes$5;
304
+ Login.defaultProps = defaultProps$5;
225
305
 
226
- var _excluded$5 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
227
- var propTypes$5 = {
306
+ var _excluded$4 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
307
+ var propTypes$4 = {
228
308
  action: PropTypes__default["default"].string,
229
309
  fields: core.PropTypes.fields,
230
310
  size: PropTypes__default["default"].string,
@@ -237,7 +317,7 @@ var propTypes$5 = {
237
317
  loginLink: PropTypes__default["default"].string,
238
318
  loginLabel: core.PropTypes.label
239
319
  };
240
- var defaultProps$5 = {
320
+ var defaultProps$4 = {
241
321
  action: '/register',
242
322
  fields: null,
243
323
  size: 'lg',
@@ -277,7 +357,7 @@ var defaultProps$5 = {
277
357
  }]
278
358
  }),
279
359
  withLoginLink: true,
280
- loginLink: '/forgot-password',
360
+ loginLink: '/login',
281
361
  loginLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
282
362
  id: "wa783M",
283
363
  defaultMessage: [{
@@ -299,7 +379,7 @@ var Register = function Register(_ref) {
299
379
  withLoginLink = _ref.withLoginLink,
300
380
  loginLink = _ref.loginLink,
301
381
  loginLabel = _ref.loginLabel,
302
- props = _objectWithoutProperties__default["default"](_ref, _excluded$5);
382
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
303
383
 
304
384
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
305
385
  action: action,
@@ -332,22 +412,30 @@ var Register = function Register(_ref) {
332
412
  }, props));
333
413
  };
334
414
 
335
- Register.propTypes = propTypes$5;
336
- Register.defaultProps = defaultProps$5;
415
+ Register.propTypes = propTypes$4;
416
+ Register.defaultProps = defaultProps$4;
337
417
 
338
- var _excluded$4 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
339
- var propTypes$4 = {
418
+ var _excluded$3 = ["action", "fields", "size", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
419
+ var propTypes$3 = {
340
420
  action: PropTypes__default["default"].string,
341
421
  fields: core.PropTypes.fields,
342
422
  size: PropTypes__default["default"].string,
423
+ emailLabel: core.PropTypes.label,
343
424
  passwordLabel: core.PropTypes.label,
344
425
  passwordConfirmationLabel: core.PropTypes.label,
345
426
  submitButtonLabel: core.PropTypes.label
346
427
  };
347
- var defaultProps$4 = {
428
+ var defaultProps$3 = {
348
429
  action: '/reset-password',
349
430
  fields: null,
350
431
  size: 'lg',
432
+ emailLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
433
+ id: "LI0Gz4",
434
+ defaultMessage: [{
435
+ "type": 0,
436
+ "value": "Email"
437
+ }]
438
+ }),
351
439
  passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
352
440
  id: "4yfet+",
353
441
  defaultMessage: [{
@@ -375,20 +463,27 @@ var ResetPassword = function ResetPassword(_ref) {
375
463
  var action = _ref.action,
376
464
  fields = _ref.fields,
377
465
  size = _ref.size,
466
+ emailLabel = _ref.emailLabel,
378
467
  passwordLabel = _ref.passwordLabel,
379
468
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
380
469
  submitButtonLabel = _ref.submitButtonLabel,
381
- props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
470
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
382
471
 
383
472
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
384
473
  action: action,
385
474
  fields: fields || [{
475
+ name: 'email',
476
+ type: 'email',
477
+ size: size,
478
+ label: emailLabel,
479
+ readOnly: true
480
+ }, {
386
481
  name: 'password',
387
482
  type: 'password',
388
483
  size: size,
389
484
  label: passwordLabel
390
485
  }, {
391
- name: 'password_confrmation',
486
+ name: 'password_confirmation',
392
487
  type: 'password',
393
488
  size: size,
394
489
  label: passwordConfirmationLabel
@@ -397,18 +492,18 @@ var ResetPassword = function ResetPassword(_ref) {
397
492
  }, props));
398
493
  };
399
494
 
400
- ResetPassword.propTypes = propTypes$4;
401
- ResetPassword.defaultProps = defaultProps$4;
495
+ ResetPassword.propTypes = propTypes$3;
496
+ ResetPassword.defaultProps = defaultProps$3;
402
497
 
403
- var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
404
- var propTypes$3 = {
498
+ var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
499
+ var propTypes$2 = {
405
500
  action: PropTypes__default["default"].string,
406
501
  fields: core.PropTypes.fields,
407
502
  size: PropTypes__default["default"].string,
408
503
  codeLabel: core.PropTypes.label,
409
504
  submitButtonLabel: core.PropTypes.label
410
505
  };
411
- var defaultProps$3 = {
506
+ var defaultProps$2 = {
412
507
  action: '/two-factor-challenge',
413
508
  fields: null,
414
509
  size: 'lg',
@@ -434,7 +529,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
434
529
  size = _ref.size,
435
530
  codeLabel = _ref.codeLabel,
436
531
  submitButtonLabel = _ref.submitButtonLabel,
437
- props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
532
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
438
533
 
439
534
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
440
535
  action: action,
@@ -448,11 +543,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
448
543
  }, props));
449
544
  };
450
545
 
451
- TwoFactorChallenge.propTypes = propTypes$3;
452
- TwoFactorChallenge.defaultProps = defaultProps$3;
546
+ TwoFactorChallenge.propTypes = propTypes$2;
547
+ TwoFactorChallenge.defaultProps = defaultProps$2;
453
548
 
454
- var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
455
- var propTypes$2 = {
549
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
550
+ var propTypes$1 = {
456
551
  action: PropTypes__default["default"].string,
457
552
  fields: core.PropTypes.fields,
458
553
  size: PropTypes__default["default"].string,
@@ -462,7 +557,7 @@ var propTypes$2 = {
462
557
  cancelLink: PropTypes__default["default"].string,
463
558
  cancelLabel: core.PropTypes.label
464
559
  };
465
- var defaultProps$2 = {
560
+ var defaultProps$1 = {
466
561
  action: '/user/two-factor-authentication',
467
562
  fields: null,
468
563
  size: 'lg',
@@ -500,7 +595,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
500
595
  var withCancelLink = _ref.withCancelLink,
501
596
  cancelLink = _ref.cancelLink,
502
597
  cancelLabel = _ref.cancelLabel,
503
- props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
598
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
504
599
 
505
600
  var defaultPostForm = React.useCallback(function (act, data) {
506
601
  return fetch.postJSON(act, data, {
@@ -520,11 +615,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
520
615
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
521
616
  };
522
617
 
523
- TwoFactorDisable.propTypes = propTypes$2;
524
- TwoFactorDisable.defaultProps = defaultProps$2;
618
+ TwoFactorDisable.propTypes = propTypes$1;
619
+ TwoFactorDisable.defaultProps = defaultProps$1;
525
620
 
526
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
527
- var propTypes$1 = {
621
+ var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
622
+ var propTypes = {
528
623
  action: PropTypes__default["default"].string,
529
624
  fields: core.PropTypes.fields,
530
625
  size: PropTypes__default["default"].string,
@@ -534,7 +629,7 @@ var propTypes$1 = {
534
629
  skipLink: PropTypes__default["default"].string,
535
630
  skipLabel: core.PropTypes.label
536
631
  };
537
- var defaultProps$1 = {
632
+ var defaultProps = {
538
633
  action: '/user/two-factor-authentication',
539
634
  fields: null,
540
635
  size: 'lg',
@@ -572,7 +667,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
572
667
  var withSkipLink = _ref.withSkipLink,
573
668
  skipLink = _ref.skipLink,
574
669
  skipLabel = _ref.skipLabel,
575
- props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
670
+ props = _objectWithoutProperties__default["default"](_ref, _excluded);
576
671
 
577
672
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
578
673
  action: action,
@@ -584,89 +679,10 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
584
679
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
585
680
  };
586
681
 
587
- TwoFactorEnable.propTypes = propTypes$1;
588
- TwoFactorEnable.defaultProps = defaultProps$1;
589
-
590
- var _excluded = ["action", "fields", "size", "currentPasswordLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
591
- var propTypes = {
592
- action: PropTypes__default["default"].string,
593
- fields: core.PropTypes.fields,
594
- size: PropTypes__default["default"].string,
595
- currentPasswordLabel: core.PropTypes.label,
596
- passwordLabel: core.PropTypes.label,
597
- passwordConfirmationLabel: core.PropTypes.label,
598
- submitButtonLabel: core.PropTypes.label
599
- };
600
- var defaultProps = {
601
- action: '/user/password',
602
- fields: null,
603
- size: 'lg',
604
- currentPasswordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
605
- id: "8LSb8C",
606
- defaultMessage: [{
607
- "type": 0,
608
- "value": "Current password"
609
- }]
610
- }),
611
- passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
612
- id: "4yfet+",
613
- defaultMessage: [{
614
- "type": 0,
615
- "value": "Password"
616
- }]
617
- }),
618
- passwordConfirmationLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
619
- id: "VhJUeW",
620
- defaultMessage: [{
621
- "type": 0,
622
- "value": "Confirm your password"
623
- }]
624
- }),
625
- submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
626
- id: "XW9IKQ",
627
- defaultMessage: [{
628
- "type": 0,
629
- "value": "Update password"
630
- }]
631
- })
632
- };
633
-
634
- var UpdatePassword = function UpdatePassword(_ref) {
635
- var action = _ref.action,
636
- fields = _ref.fields,
637
- size = _ref.size,
638
- currentPasswordLabel = _ref.currentPasswordLabel,
639
- passwordLabel = _ref.passwordLabel,
640
- passwordConfirmationLabel = _ref.passwordConfirmationLabel,
641
- submitButtonLabel = _ref.submitButtonLabel,
642
- props = _objectWithoutProperties__default["default"](_ref, _excluded);
643
-
644
- return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
645
- action: action,
646
- method: "PUT",
647
- fields: fields || [{
648
- name: 'current_password',
649
- type: 'password',
650
- size: size,
651
- label: currentPasswordLabel
652
- }, {
653
- name: 'password',
654
- type: 'password',
655
- size: size,
656
- label: passwordLabel
657
- }, {
658
- name: 'password_confrmation',
659
- type: 'password',
660
- size: size,
661
- label: passwordConfirmationLabel
662
- }],
663
- submitButtonLabel: submitButtonLabel
664
- }, props));
665
- };
666
-
667
- UpdatePassword.propTypes = propTypes;
668
- UpdatePassword.defaultProps = defaultProps;
682
+ TwoFactorEnable.propTypes = propTypes;
683
+ TwoFactorEnable.defaultProps = defaultProps;
669
684
 
685
+ exports.ChangePassword = ChangePassword;
670
686
  exports.ConfirmPassword = ConfirmPassword;
671
687
  exports.ForgotPassword = ForgotPassword;
672
688
  exports.Login = Login;
@@ -675,4 +691,3 @@ exports.ResetPassword = ResetPassword;
675
691
  exports.TwoFactorChallenge = TwoFactorChallenge;
676
692
  exports.TwoFactorDisable = TwoFactorDisable;
677
693
  exports.TwoFactorEnable = TwoFactorEnable;
678
- exports.UpdatePassword = UpdatePassword;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/form-auth",
3
- "version": "1.0.0-alpha.246",
3
+ "version": "1.0.0-alpha.249",
4
4
  "description": "Basic forgot password form",
5
5
  "keywords": [
6
6
  "javascript"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "a63e2faa39a9095392bfcad7ae9945a4365934a0"
61
+ "gitHead": "27c0004d2d105e9c82cc717d78237d59c23294dc"
62
62
  }