@panneau/form-auth 1.0.0-alpha.244 → 1.0.0-alpha.247

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