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

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 +129 -63
  2. package/lib/index.js +129 -62
  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',
@@ -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,30 +321,22 @@ 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", "currentPasswordLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
328
- var propTypes$3 = {
327
+ var _excluded$4 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
328
+ var propTypes$4 = {
329
329
  action: PropTypes.string,
330
330
  fields: PropTypes$1.fields,
331
331
  size: PropTypes.string,
332
- currentPasswordLabel: PropTypes$1.label,
333
332
  passwordLabel: PropTypes$1.label,
334
333
  passwordConfirmationLabel: PropTypes$1.label,
335
334
  submitButtonLabel: PropTypes$1.label
336
335
  };
337
- var defaultProps$3 = {
336
+ var defaultProps$4 = {
338
337
  action: '/reset-password',
339
338
  fields: null,
340
339
  size: 'lg',
341
- currentPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
342
- id: "8LSb8C",
343
- defaultMessage: [{
344
- "type": 0,
345
- "value": "Current password"
346
- }]
347
- }),
348
340
  passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
349
341
  id: "4yfet+",
350
342
  defaultMessage: [{
@@ -372,20 +364,14 @@ var ResetPassword = function ResetPassword(_ref) {
372
364
  var action = _ref.action,
373
365
  fields = _ref.fields,
374
366
  size = _ref.size,
375
- currentPasswordLabel = _ref.currentPasswordLabel,
376
367
  passwordLabel = _ref.passwordLabel,
377
368
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
378
369
  submitButtonLabel = _ref.submitButtonLabel,
379
- props = _objectWithoutProperties(_ref, _excluded$3);
370
+ props = _objectWithoutProperties(_ref, _excluded$4);
380
371
 
381
372
  return /*#__PURE__*/React.createElement(Form, Object.assign({
382
373
  action: action,
383
374
  fields: fields || [{
384
- name: 'current_password',
385
- type: 'password',
386
- size: size,
387
- label: currentPasswordLabel
388
- }, {
389
375
  name: 'password',
390
376
  type: 'password',
391
377
  size: size,
@@ -400,18 +386,18 @@ var ResetPassword = function ResetPassword(_ref) {
400
386
  }, props));
401
387
  };
402
388
 
403
- ResetPassword.propTypes = propTypes$3;
404
- ResetPassword.defaultProps = defaultProps$3;
389
+ ResetPassword.propTypes = propTypes$4;
390
+ ResetPassword.defaultProps = defaultProps$4;
405
391
 
406
- var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
407
- var propTypes$2 = {
392
+ var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
393
+ var propTypes$3 = {
408
394
  action: PropTypes.string,
409
395
  fields: PropTypes$1.fields,
410
396
  size: PropTypes.string,
411
397
  codeLabel: PropTypes$1.label,
412
398
  submitButtonLabel: PropTypes$1.label
413
399
  };
414
- var defaultProps$2 = {
400
+ var defaultProps$3 = {
415
401
  action: '/two-factor-challenge',
416
402
  fields: null,
417
403
  size: 'lg',
@@ -437,7 +423,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
437
423
  size = _ref.size,
438
424
  codeLabel = _ref.codeLabel,
439
425
  submitButtonLabel = _ref.submitButtonLabel,
440
- props = _objectWithoutProperties(_ref, _excluded$2);
426
+ props = _objectWithoutProperties(_ref, _excluded$3);
441
427
 
442
428
  return /*#__PURE__*/React.createElement(Form, Object.assign({
443
429
  action: action,
@@ -451,11 +437,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
451
437
  }, props));
452
438
  };
453
439
 
454
- TwoFactorChallenge.propTypes = propTypes$2;
455
- TwoFactorChallenge.defaultProps = defaultProps$2;
440
+ TwoFactorChallenge.propTypes = propTypes$3;
441
+ TwoFactorChallenge.defaultProps = defaultProps$3;
456
442
 
457
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
458
- var propTypes$1 = {
443
+ var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
444
+ var propTypes$2 = {
459
445
  action: PropTypes.string,
460
446
  fields: PropTypes$1.fields,
461
447
  size: PropTypes.string,
@@ -465,7 +451,7 @@ var propTypes$1 = {
465
451
  cancelLink: PropTypes.string,
466
452
  cancelLabel: PropTypes$1.label
467
453
  };
468
- var defaultProps$1 = {
454
+ var defaultProps$2 = {
469
455
  action: '/user/two-factor-authentication',
470
456
  fields: null,
471
457
  size: 'lg',
@@ -503,7 +489,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
503
489
  var withCancelLink = _ref.withCancelLink,
504
490
  cancelLink = _ref.cancelLink,
505
491
  cancelLabel = _ref.cancelLabel,
506
- props = _objectWithoutProperties(_ref, _excluded$1);
492
+ props = _objectWithoutProperties(_ref, _excluded$2);
507
493
 
508
494
  var defaultPostForm = useCallback(function (act, data) {
509
495
  return postJSON(act, data, {
@@ -523,11 +509,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
523
509
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
524
510
  };
525
511
 
526
- TwoFactorDisable.propTypes = propTypes$1;
527
- TwoFactorDisable.defaultProps = defaultProps$1;
512
+ TwoFactorDisable.propTypes = propTypes$2;
513
+ TwoFactorDisable.defaultProps = defaultProps$2;
528
514
 
529
- var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
530
- var propTypes = {
515
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
516
+ var propTypes$1 = {
531
517
  action: PropTypes.string,
532
518
  fields: PropTypes$1.fields,
533
519
  size: PropTypes.string,
@@ -537,7 +523,7 @@ var propTypes = {
537
523
  skipLink: PropTypes.string,
538
524
  skipLabel: PropTypes$1.label
539
525
  };
540
- var defaultProps = {
526
+ var defaultProps$1 = {
541
527
  action: '/user/two-factor-authentication',
542
528
  fields: null,
543
529
  size: 'lg',
@@ -575,7 +561,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
575
561
  var withSkipLink = _ref.withSkipLink,
576
562
  skipLink = _ref.skipLink,
577
563
  skipLabel = _ref.skipLabel,
578
- props = _objectWithoutProperties(_ref, _excluded);
564
+ props = _objectWithoutProperties(_ref, _excluded$1);
579
565
 
580
566
  return /*#__PURE__*/React.createElement(Form, Object.assign({
581
567
  action: action,
@@ -587,7 +573,87 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
587
573
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
588
574
  };
589
575
 
590
- TwoFactorEnable.propTypes = propTypes;
591
- TwoFactorEnable.defaultProps = defaultProps;
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;
592
658
 
593
- export { ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable };
659
+ 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',
@@ -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,30 +332,22 @@ 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", "currentPasswordLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
339
- var propTypes$3 = {
338
+ var _excluded$4 = ["action", "fields", "size", "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
- currentPasswordLabel: core.PropTypes.label,
344
343
  passwordLabel: core.PropTypes.label,
345
344
  passwordConfirmationLabel: core.PropTypes.label,
346
345
  submitButtonLabel: core.PropTypes.label
347
346
  };
348
- var defaultProps$3 = {
347
+ var defaultProps$4 = {
349
348
  action: '/reset-password',
350
349
  fields: null,
351
350
  size: 'lg',
352
- currentPasswordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
353
- id: "8LSb8C",
354
- defaultMessage: [{
355
- "type": 0,
356
- "value": "Current password"
357
- }]
358
- }),
359
351
  passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
360
352
  id: "4yfet+",
361
353
  defaultMessage: [{
@@ -383,20 +375,14 @@ var ResetPassword = function ResetPassword(_ref) {
383
375
  var action = _ref.action,
384
376
  fields = _ref.fields,
385
377
  size = _ref.size,
386
- currentPasswordLabel = _ref.currentPasswordLabel,
387
378
  passwordLabel = _ref.passwordLabel,
388
379
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
389
380
  submitButtonLabel = _ref.submitButtonLabel,
390
- props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
381
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
391
382
 
392
383
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
393
384
  action: action,
394
385
  fields: fields || [{
395
- name: 'current_password',
396
- type: 'password',
397
- size: size,
398
- label: currentPasswordLabel
399
- }, {
400
386
  name: 'password',
401
387
  type: 'password',
402
388
  size: size,
@@ -411,18 +397,18 @@ var ResetPassword = function ResetPassword(_ref) {
411
397
  }, props));
412
398
  };
413
399
 
414
- ResetPassword.propTypes = propTypes$3;
415
- ResetPassword.defaultProps = defaultProps$3;
400
+ ResetPassword.propTypes = propTypes$4;
401
+ ResetPassword.defaultProps = defaultProps$4;
416
402
 
417
- var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
418
- var propTypes$2 = {
403
+ var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
404
+ var propTypes$3 = {
419
405
  action: PropTypes__default["default"].string,
420
406
  fields: core.PropTypes.fields,
421
407
  size: PropTypes__default["default"].string,
422
408
  codeLabel: core.PropTypes.label,
423
409
  submitButtonLabel: core.PropTypes.label
424
410
  };
425
- var defaultProps$2 = {
411
+ var defaultProps$3 = {
426
412
  action: '/two-factor-challenge',
427
413
  fields: null,
428
414
  size: 'lg',
@@ -448,7 +434,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
448
434
  size = _ref.size,
449
435
  codeLabel = _ref.codeLabel,
450
436
  submitButtonLabel = _ref.submitButtonLabel,
451
- props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
437
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
452
438
 
453
439
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
454
440
  action: action,
@@ -462,11 +448,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
462
448
  }, props));
463
449
  };
464
450
 
465
- TwoFactorChallenge.propTypes = propTypes$2;
466
- TwoFactorChallenge.defaultProps = defaultProps$2;
451
+ TwoFactorChallenge.propTypes = propTypes$3;
452
+ TwoFactorChallenge.defaultProps = defaultProps$3;
467
453
 
468
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
469
- var propTypes$1 = {
454
+ var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
455
+ var propTypes$2 = {
470
456
  action: PropTypes__default["default"].string,
471
457
  fields: core.PropTypes.fields,
472
458
  size: PropTypes__default["default"].string,
@@ -476,7 +462,7 @@ var propTypes$1 = {
476
462
  cancelLink: PropTypes__default["default"].string,
477
463
  cancelLabel: core.PropTypes.label
478
464
  };
479
- var defaultProps$1 = {
465
+ var defaultProps$2 = {
480
466
  action: '/user/two-factor-authentication',
481
467
  fields: null,
482
468
  size: 'lg',
@@ -514,7 +500,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
514
500
  var withCancelLink = _ref.withCancelLink,
515
501
  cancelLink = _ref.cancelLink,
516
502
  cancelLabel = _ref.cancelLabel,
517
- props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
503
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
518
504
 
519
505
  var defaultPostForm = React.useCallback(function (act, data) {
520
506
  return fetch.postJSON(act, data, {
@@ -534,11 +520,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
534
520
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
535
521
  };
536
522
 
537
- TwoFactorDisable.propTypes = propTypes$1;
538
- TwoFactorDisable.defaultProps = defaultProps$1;
523
+ TwoFactorDisable.propTypes = propTypes$2;
524
+ TwoFactorDisable.defaultProps = defaultProps$2;
539
525
 
540
- var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
541
- var propTypes = {
526
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
527
+ var propTypes$1 = {
542
528
  action: PropTypes__default["default"].string,
543
529
  fields: core.PropTypes.fields,
544
530
  size: PropTypes__default["default"].string,
@@ -548,7 +534,7 @@ var propTypes = {
548
534
  skipLink: PropTypes__default["default"].string,
549
535
  skipLabel: core.PropTypes.label
550
536
  };
551
- var defaultProps = {
537
+ var defaultProps$1 = {
552
538
  action: '/user/two-factor-authentication',
553
539
  fields: null,
554
540
  size: 'lg',
@@ -586,7 +572,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
586
572
  var withSkipLink = _ref.withSkipLink,
587
573
  skipLink = _ref.skipLink,
588
574
  skipLabel = _ref.skipLabel,
589
- props = _objectWithoutProperties__default["default"](_ref, _excluded);
575
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
590
576
 
591
577
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
592
578
  action: action,
@@ -598,8 +584,88 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
598
584
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
599
585
  };
600
586
 
601
- TwoFactorEnable.propTypes = propTypes;
602
- TwoFactorEnable.defaultProps = defaultProps;
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;
603
669
 
604
670
  exports.ConfirmPassword = ConfirmPassword;
605
671
  exports.ForgotPassword = ForgotPassword;
@@ -609,3 +675,4 @@ exports.ResetPassword = ResetPassword;
609
675
  exports.TwoFactorChallenge = TwoFactorChallenge;
610
676
  exports.TwoFactorDisable = TwoFactorDisable;
611
677
  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.245",
3
+ "version": "1.0.0-alpha.246",
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": "9d948c9236716fbb3e1d2dbb36bb392ccaee63a6"
61
+ "gitHead": "a63e2faa39a9095392bfcad7ae9945a4365934a0"
62
62
  }