@panneau/form-auth 1.0.0-alpha.243 → 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 -50
  2. package/lib/index.js +129 -49
  3. package/package.json +3 -3
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,9 +226,8 @@ 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
- // https://bold.media.test:8080/register
232
231
  fields: null,
233
232
  size: 'lg',
234
233
  nameLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -289,7 +288,7 @@ var Register = function Register(_ref) {
289
288
  withLoginLink = _ref.withLoginLink,
290
289
  loginLink = _ref.loginLink,
291
290
  loginLabel = _ref.loginLabel,
292
- props = _objectWithoutProperties(_ref, _excluded$4);
291
+ props = _objectWithoutProperties(_ref, _excluded$5);
293
292
 
294
293
  return /*#__PURE__*/React.createElement(Form, Object.assign({
295
294
  action: action,
@@ -322,11 +321,11 @@ var Register = function Register(_ref) {
322
321
  }, props));
323
322
  };
324
323
 
325
- Register.propTypes = propTypes$4;
326
- Register.defaultProps = defaultProps$4;
324
+ Register.propTypes = propTypes$5;
325
+ Register.defaultProps = defaultProps$5;
327
326
 
328
- var _excluded$3 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
329
- var propTypes$3 = {
327
+ var _excluded$4 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
328
+ var propTypes$4 = {
330
329
  action: PropTypes.string,
331
330
  fields: PropTypes$1.fields,
332
331
  size: PropTypes.string,
@@ -334,7 +333,7 @@ var propTypes$3 = {
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',
@@ -368,7 +367,7 @@ var ResetPassword = function ResetPassword(_ref) {
368
367
  passwordLabel = _ref.passwordLabel,
369
368
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
370
369
  submitButtonLabel = _ref.submitButtonLabel,
371
- props = _objectWithoutProperties(_ref, _excluded$3);
370
+ props = _objectWithoutProperties(_ref, _excluded$4);
372
371
 
373
372
  return /*#__PURE__*/React.createElement(Form, Object.assign({
374
373
  action: action,
@@ -387,18 +386,18 @@ var ResetPassword = function ResetPassword(_ref) {
387
386
  }, props));
388
387
  };
389
388
 
390
- ResetPassword.propTypes = propTypes$3;
391
- ResetPassword.defaultProps = defaultProps$3;
389
+ ResetPassword.propTypes = propTypes$4;
390
+ ResetPassword.defaultProps = defaultProps$4;
392
391
 
393
- var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
394
- var propTypes$2 = {
392
+ var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
393
+ var propTypes$3 = {
395
394
  action: PropTypes.string,
396
395
  fields: PropTypes$1.fields,
397
396
  size: PropTypes.string,
398
397
  codeLabel: PropTypes$1.label,
399
398
  submitButtonLabel: PropTypes$1.label
400
399
  };
401
- var defaultProps$2 = {
400
+ var defaultProps$3 = {
402
401
  action: '/two-factor-challenge',
403
402
  fields: null,
404
403
  size: 'lg',
@@ -424,7 +423,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
424
423
  size = _ref.size,
425
424
  codeLabel = _ref.codeLabel,
426
425
  submitButtonLabel = _ref.submitButtonLabel,
427
- props = _objectWithoutProperties(_ref, _excluded$2);
426
+ props = _objectWithoutProperties(_ref, _excluded$3);
428
427
 
429
428
  return /*#__PURE__*/React.createElement(Form, Object.assign({
430
429
  action: action,
@@ -438,11 +437,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
438
437
  }, props));
439
438
  };
440
439
 
441
- TwoFactorChallenge.propTypes = propTypes$2;
442
- TwoFactorChallenge.defaultProps = defaultProps$2;
440
+ TwoFactorChallenge.propTypes = propTypes$3;
441
+ TwoFactorChallenge.defaultProps = defaultProps$3;
443
442
 
444
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
445
- var propTypes$1 = {
443
+ var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
444
+ var propTypes$2 = {
446
445
  action: PropTypes.string,
447
446
  fields: PropTypes$1.fields,
448
447
  size: PropTypes.string,
@@ -452,7 +451,7 @@ var propTypes$1 = {
452
451
  cancelLink: PropTypes.string,
453
452
  cancelLabel: PropTypes$1.label
454
453
  };
455
- var defaultProps$1 = {
454
+ var defaultProps$2 = {
456
455
  action: '/user/two-factor-authentication',
457
456
  fields: null,
458
457
  size: 'lg',
@@ -490,7 +489,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
490
489
  var withCancelLink = _ref.withCancelLink,
491
490
  cancelLink = _ref.cancelLink,
492
491
  cancelLabel = _ref.cancelLabel,
493
- props = _objectWithoutProperties(_ref, _excluded$1);
492
+ props = _objectWithoutProperties(_ref, _excluded$2);
494
493
 
495
494
  var defaultPostForm = useCallback(function (act, data) {
496
495
  return postJSON(act, data, {
@@ -510,11 +509,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
510
509
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
511
510
  };
512
511
 
513
- TwoFactorDisable.propTypes = propTypes$1;
514
- TwoFactorDisable.defaultProps = defaultProps$1;
512
+ TwoFactorDisable.propTypes = propTypes$2;
513
+ TwoFactorDisable.defaultProps = defaultProps$2;
515
514
 
516
- var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
517
- var propTypes = {
515
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
516
+ var propTypes$1 = {
518
517
  action: PropTypes.string,
519
518
  fields: PropTypes$1.fields,
520
519
  size: PropTypes.string,
@@ -524,7 +523,7 @@ var propTypes = {
524
523
  skipLink: PropTypes.string,
525
524
  skipLabel: PropTypes$1.label
526
525
  };
527
- var defaultProps = {
526
+ var defaultProps$1 = {
528
527
  action: '/user/two-factor-authentication',
529
528
  fields: null,
530
529
  size: 'lg',
@@ -562,7 +561,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
562
561
  var withSkipLink = _ref.withSkipLink,
563
562
  skipLink = _ref.skipLink,
564
563
  skipLabel = _ref.skipLabel,
565
- props = _objectWithoutProperties(_ref, _excluded);
564
+ props = _objectWithoutProperties(_ref, _excluded$1);
566
565
 
567
566
  return /*#__PURE__*/React.createElement(Form, Object.assign({
568
567
  action: action,
@@ -574,7 +573,87 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
574
573
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
575
574
  };
576
575
 
577
- TwoFactorEnable.propTypes = propTypes;
578
- 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;
579
658
 
580
- 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,9 +237,8 @@ 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
- // https://bold.media.test:8080/register
243
242
  fields: null,
244
243
  size: 'lg',
245
244
  nameLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
@@ -300,7 +299,7 @@ var Register = function Register(_ref) {
300
299
  withLoginLink = _ref.withLoginLink,
301
300
  loginLink = _ref.loginLink,
302
301
  loginLabel = _ref.loginLabel,
303
- props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
302
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$5);
304
303
 
305
304
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
306
305
  action: action,
@@ -333,11 +332,11 @@ var Register = function Register(_ref) {
333
332
  }, props));
334
333
  };
335
334
 
336
- Register.propTypes = propTypes$4;
337
- Register.defaultProps = defaultProps$4;
335
+ Register.propTypes = propTypes$5;
336
+ Register.defaultProps = defaultProps$5;
338
337
 
339
- var _excluded$3 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
340
- var propTypes$3 = {
338
+ var _excluded$4 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
339
+ var propTypes$4 = {
341
340
  action: PropTypes__default["default"].string,
342
341
  fields: core.PropTypes.fields,
343
342
  size: PropTypes__default["default"].string,
@@ -345,7 +344,7 @@ var propTypes$3 = {
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',
@@ -379,7 +378,7 @@ var ResetPassword = function ResetPassword(_ref) {
379
378
  passwordLabel = _ref.passwordLabel,
380
379
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
381
380
  submitButtonLabel = _ref.submitButtonLabel,
382
- props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
381
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
383
382
 
384
383
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
385
384
  action: action,
@@ -398,18 +397,18 @@ var ResetPassword = function ResetPassword(_ref) {
398
397
  }, props));
399
398
  };
400
399
 
401
- ResetPassword.propTypes = propTypes$3;
402
- ResetPassword.defaultProps = defaultProps$3;
400
+ ResetPassword.propTypes = propTypes$4;
401
+ ResetPassword.defaultProps = defaultProps$4;
403
402
 
404
- var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
405
- var propTypes$2 = {
403
+ var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
404
+ var propTypes$3 = {
406
405
  action: PropTypes__default["default"].string,
407
406
  fields: core.PropTypes.fields,
408
407
  size: PropTypes__default["default"].string,
409
408
  codeLabel: core.PropTypes.label,
410
409
  submitButtonLabel: core.PropTypes.label
411
410
  };
412
- var defaultProps$2 = {
411
+ var defaultProps$3 = {
413
412
  action: '/two-factor-challenge',
414
413
  fields: null,
415
414
  size: 'lg',
@@ -435,7 +434,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
435
434
  size = _ref.size,
436
435
  codeLabel = _ref.codeLabel,
437
436
  submitButtonLabel = _ref.submitButtonLabel,
438
- props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
437
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
439
438
 
440
439
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
441
440
  action: action,
@@ -449,11 +448,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
449
448
  }, props));
450
449
  };
451
450
 
452
- TwoFactorChallenge.propTypes = propTypes$2;
453
- TwoFactorChallenge.defaultProps = defaultProps$2;
451
+ TwoFactorChallenge.propTypes = propTypes$3;
452
+ TwoFactorChallenge.defaultProps = defaultProps$3;
454
453
 
455
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
456
- var propTypes$1 = {
454
+ var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
455
+ var propTypes$2 = {
457
456
  action: PropTypes__default["default"].string,
458
457
  fields: core.PropTypes.fields,
459
458
  size: PropTypes__default["default"].string,
@@ -463,7 +462,7 @@ var propTypes$1 = {
463
462
  cancelLink: PropTypes__default["default"].string,
464
463
  cancelLabel: core.PropTypes.label
465
464
  };
466
- var defaultProps$1 = {
465
+ var defaultProps$2 = {
467
466
  action: '/user/two-factor-authentication',
468
467
  fields: null,
469
468
  size: 'lg',
@@ -501,7 +500,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
501
500
  var withCancelLink = _ref.withCancelLink,
502
501
  cancelLink = _ref.cancelLink,
503
502
  cancelLabel = _ref.cancelLabel,
504
- props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
503
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
505
504
 
506
505
  var defaultPostForm = React.useCallback(function (act, data) {
507
506
  return fetch.postJSON(act, data, {
@@ -521,11 +520,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
521
520
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
522
521
  };
523
522
 
524
- TwoFactorDisable.propTypes = propTypes$1;
525
- TwoFactorDisable.defaultProps = defaultProps$1;
523
+ TwoFactorDisable.propTypes = propTypes$2;
524
+ TwoFactorDisable.defaultProps = defaultProps$2;
526
525
 
527
- var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
528
- var propTypes = {
526
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
527
+ var propTypes$1 = {
529
528
  action: PropTypes__default["default"].string,
530
529
  fields: core.PropTypes.fields,
531
530
  size: PropTypes__default["default"].string,
@@ -535,7 +534,7 @@ var propTypes = {
535
534
  skipLink: PropTypes__default["default"].string,
536
535
  skipLabel: core.PropTypes.label
537
536
  };
538
- var defaultProps = {
537
+ var defaultProps$1 = {
539
538
  action: '/user/two-factor-authentication',
540
539
  fields: null,
541
540
  size: 'lg',
@@ -573,7 +572,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
573
572
  var withSkipLink = _ref.withSkipLink,
574
573
  skipLink = _ref.skipLink,
575
574
  skipLabel = _ref.skipLabel,
576
- props = _objectWithoutProperties__default["default"](_ref, _excluded);
575
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
577
576
 
578
577
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
579
578
  action: action,
@@ -585,8 +584,88 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
585
584
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
586
585
  };
587
586
 
588
- TwoFactorEnable.propTypes = propTypes;
589
- 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;
590
669
 
591
670
  exports.ConfirmPassword = ConfirmPassword;
592
671
  exports.ForgotPassword = ForgotPassword;
@@ -596,3 +675,4 @@ exports.ResetPassword = ResetPassword;
596
675
  exports.TwoFactorChallenge = TwoFactorChallenge;
597
676
  exports.TwoFactorDisable = TwoFactorDisable;
598
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.243",
3
+ "version": "1.0.0-alpha.246",
4
4
  "description": "Basic forgot password form",
5
5
  "keywords": [
6
6
  "javascript"
@@ -48,7 +48,7 @@
48
48
  "@babel/runtime": "^7.12.5",
49
49
  "@folklore/fetch": "^0.1.15",
50
50
  "@panneau/core": "^1.0.0-alpha.242",
51
- "@panneau/form": "^1.0.0-alpha.242",
51
+ "@panneau/form": "^1.0.0-alpha.244",
52
52
  "classnames": "^2.2.6",
53
53
  "lodash": "^4.17.21",
54
54
  "prop-types": "^15.7.2",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "9703e84a7d27cfc0024e95e7f82da20d1637079a"
61
+ "gitHead": "a63e2faa39a9095392bfcad7ae9945a4365934a0"
62
62
  }