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

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 +141 -60
  2. package/lib/index.js +141 -59
  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,28 +321,28 @@ 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", "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
- currentPasswordLabel: PropTypes$1.label,
332
+ emailLabel: PropTypes$1.label,
333
333
  passwordLabel: PropTypes$1.label,
334
334
  passwordConfirmationLabel: PropTypes$1.label,
335
335
  submitButtonLabel: PropTypes$1.label
336
336
  };
337
- var defaultProps$3 = {
337
+ var defaultProps$4 = {
338
338
  action: '/reset-password',
339
339
  fields: null,
340
340
  size: 'lg',
341
- currentPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
342
- id: "8LSb8C",
341
+ emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
342
+ id: "LI0Gz4",
343
343
  defaultMessage: [{
344
344
  "type": 0,
345
- "value": "Current password"
345
+ "value": "Email"
346
346
  }]
347
347
  }),
348
348
  passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -366,32 +366,33 @@ var defaultProps$3 = {
366
366
  "value": "Save new password"
367
367
  }]
368
368
  })
369
- };
369
+ }; //
370
370
 
371
371
  var ResetPassword = function ResetPassword(_ref) {
372
372
  var action = _ref.action,
373
373
  fields = _ref.fields,
374
374
  size = _ref.size,
375
- currentPasswordLabel = _ref.currentPasswordLabel,
375
+ emailLabel = _ref.emailLabel,
376
376
  passwordLabel = _ref.passwordLabel,
377
377
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
378
378
  submitButtonLabel = _ref.submitButtonLabel,
379
- props = _objectWithoutProperties(_ref, _excluded$3);
379
+ props = _objectWithoutProperties(_ref, _excluded$4);
380
380
 
381
381
  return /*#__PURE__*/React.createElement(Form, Object.assign({
382
382
  action: action,
383
383
  fields: fields || [{
384
- name: 'current_password',
385
- type: 'password',
384
+ name: 'email',
385
+ type: 'email',
386
386
  size: size,
387
- label: currentPasswordLabel
387
+ label: emailLabel,
388
+ readOnly: true
388
389
  }, {
389
390
  name: 'password',
390
391
  type: 'password',
391
392
  size: size,
392
393
  label: passwordLabel
393
394
  }, {
394
- name: 'password_confrmation',
395
+ name: 'password_confirmation',
395
396
  type: 'password',
396
397
  size: size,
397
398
  label: passwordConfirmationLabel
@@ -400,18 +401,18 @@ var ResetPassword = function ResetPassword(_ref) {
400
401
  }, props));
401
402
  };
402
403
 
403
- ResetPassword.propTypes = propTypes$3;
404
- ResetPassword.defaultProps = defaultProps$3;
404
+ ResetPassword.propTypes = propTypes$4;
405
+ ResetPassword.defaultProps = defaultProps$4;
405
406
 
406
- var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
407
- var propTypes$2 = {
407
+ var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
408
+ var propTypes$3 = {
408
409
  action: PropTypes.string,
409
410
  fields: PropTypes$1.fields,
410
411
  size: PropTypes.string,
411
412
  codeLabel: PropTypes$1.label,
412
413
  submitButtonLabel: PropTypes$1.label
413
414
  };
414
- var defaultProps$2 = {
415
+ var defaultProps$3 = {
415
416
  action: '/two-factor-challenge',
416
417
  fields: null,
417
418
  size: 'lg',
@@ -437,7 +438,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
437
438
  size = _ref.size,
438
439
  codeLabel = _ref.codeLabel,
439
440
  submitButtonLabel = _ref.submitButtonLabel,
440
- props = _objectWithoutProperties(_ref, _excluded$2);
441
+ props = _objectWithoutProperties(_ref, _excluded$3);
441
442
 
442
443
  return /*#__PURE__*/React.createElement(Form, Object.assign({
443
444
  action: action,
@@ -451,11 +452,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
451
452
  }, props));
452
453
  };
453
454
 
454
- TwoFactorChallenge.propTypes = propTypes$2;
455
- TwoFactorChallenge.defaultProps = defaultProps$2;
455
+ TwoFactorChallenge.propTypes = propTypes$3;
456
+ TwoFactorChallenge.defaultProps = defaultProps$3;
456
457
 
457
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
458
- var propTypes$1 = {
458
+ var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
459
+ var propTypes$2 = {
459
460
  action: PropTypes.string,
460
461
  fields: PropTypes$1.fields,
461
462
  size: PropTypes.string,
@@ -465,7 +466,7 @@ var propTypes$1 = {
465
466
  cancelLink: PropTypes.string,
466
467
  cancelLabel: PropTypes$1.label
467
468
  };
468
- var defaultProps$1 = {
469
+ var defaultProps$2 = {
469
470
  action: '/user/two-factor-authentication',
470
471
  fields: null,
471
472
  size: 'lg',
@@ -503,7 +504,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
503
504
  var withCancelLink = _ref.withCancelLink,
504
505
  cancelLink = _ref.cancelLink,
505
506
  cancelLabel = _ref.cancelLabel,
506
- props = _objectWithoutProperties(_ref, _excluded$1);
507
+ props = _objectWithoutProperties(_ref, _excluded$2);
507
508
 
508
509
  var defaultPostForm = useCallback(function (act, data) {
509
510
  return postJSON(act, data, {
@@ -523,11 +524,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
523
524
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
524
525
  };
525
526
 
526
- TwoFactorDisable.propTypes = propTypes$1;
527
- TwoFactorDisable.defaultProps = defaultProps$1;
527
+ TwoFactorDisable.propTypes = propTypes$2;
528
+ TwoFactorDisable.defaultProps = defaultProps$2;
528
529
 
529
- var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
530
- var propTypes = {
530
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
531
+ var propTypes$1 = {
531
532
  action: PropTypes.string,
532
533
  fields: PropTypes$1.fields,
533
534
  size: PropTypes.string,
@@ -537,7 +538,7 @@ var propTypes = {
537
538
  skipLink: PropTypes.string,
538
539
  skipLabel: PropTypes$1.label
539
540
  };
540
- var defaultProps = {
541
+ var defaultProps$1 = {
541
542
  action: '/user/two-factor-authentication',
542
543
  fields: null,
543
544
  size: 'lg',
@@ -575,7 +576,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
575
576
  var withSkipLink = _ref.withSkipLink,
576
577
  skipLink = _ref.skipLink,
577
578
  skipLabel = _ref.skipLabel,
578
- props = _objectWithoutProperties(_ref, _excluded);
579
+ props = _objectWithoutProperties(_ref, _excluded$1);
579
580
 
580
581
  return /*#__PURE__*/React.createElement(Form, Object.assign({
581
582
  action: action,
@@ -587,7 +588,87 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
587
588
  }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
588
589
  };
589
590
 
590
- TwoFactorEnable.propTypes = propTypes;
591
- 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;
592
673
 
593
- 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,28 +332,28 @@ 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", "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
- currentPasswordLabel: core.PropTypes.label,
343
+ emailLabel: core.PropTypes.label,
344
344
  passwordLabel: core.PropTypes.label,
345
345
  passwordConfirmationLabel: core.PropTypes.label,
346
346
  submitButtonLabel: core.PropTypes.label
347
347
  };
348
- var defaultProps$3 = {
348
+ var defaultProps$4 = {
349
349
  action: '/reset-password',
350
350
  fields: null,
351
351
  size: 'lg',
352
- currentPasswordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
353
- id: "8LSb8C",
352
+ emailLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
353
+ id: "LI0Gz4",
354
354
  defaultMessage: [{
355
355
  "type": 0,
356
- "value": "Current password"
356
+ "value": "Email"
357
357
  }]
358
358
  }),
359
359
  passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
@@ -377,32 +377,33 @@ var defaultProps$3 = {
377
377
  "value": "Save new password"
378
378
  }]
379
379
  })
380
- };
380
+ }; //
381
381
 
382
382
  var ResetPassword = function ResetPassword(_ref) {
383
383
  var action = _ref.action,
384
384
  fields = _ref.fields,
385
385
  size = _ref.size,
386
- currentPasswordLabel = _ref.currentPasswordLabel,
386
+ emailLabel = _ref.emailLabel,
387
387
  passwordLabel = _ref.passwordLabel,
388
388
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
389
389
  submitButtonLabel = _ref.submitButtonLabel,
390
- props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
390
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
391
391
 
392
392
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
393
393
  action: action,
394
394
  fields: fields || [{
395
- name: 'current_password',
396
- type: 'password',
395
+ name: 'email',
396
+ type: 'email',
397
397
  size: size,
398
- label: currentPasswordLabel
398
+ label: emailLabel,
399
+ readOnly: true
399
400
  }, {
400
401
  name: 'password',
401
402
  type: 'password',
402
403
  size: size,
403
404
  label: passwordLabel
404
405
  }, {
405
- name: 'password_confrmation',
406
+ name: 'password_confirmation',
406
407
  type: 'password',
407
408
  size: size,
408
409
  label: passwordConfirmationLabel
@@ -411,18 +412,18 @@ var ResetPassword = function ResetPassword(_ref) {
411
412
  }, props));
412
413
  };
413
414
 
414
- ResetPassword.propTypes = propTypes$3;
415
- ResetPassword.defaultProps = defaultProps$3;
415
+ ResetPassword.propTypes = propTypes$4;
416
+ ResetPassword.defaultProps = defaultProps$4;
416
417
 
417
- var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
418
- var propTypes$2 = {
418
+ var _excluded$3 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
419
+ var propTypes$3 = {
419
420
  action: PropTypes__default["default"].string,
420
421
  fields: core.PropTypes.fields,
421
422
  size: PropTypes__default["default"].string,
422
423
  codeLabel: core.PropTypes.label,
423
424
  submitButtonLabel: core.PropTypes.label
424
425
  };
425
- var defaultProps$2 = {
426
+ var defaultProps$3 = {
426
427
  action: '/two-factor-challenge',
427
428
  fields: null,
428
429
  size: 'lg',
@@ -448,7 +449,7 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
448
449
  size = _ref.size,
449
450
  codeLabel = _ref.codeLabel,
450
451
  submitButtonLabel = _ref.submitButtonLabel,
451
- props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
452
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
452
453
 
453
454
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
454
455
  action: action,
@@ -462,11 +463,11 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
462
463
  }, props));
463
464
  };
464
465
 
465
- TwoFactorChallenge.propTypes = propTypes$2;
466
- TwoFactorChallenge.defaultProps = defaultProps$2;
466
+ TwoFactorChallenge.propTypes = propTypes$3;
467
+ TwoFactorChallenge.defaultProps = defaultProps$3;
467
468
 
468
- var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
469
- var propTypes$1 = {
469
+ var _excluded$2 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
470
+ var propTypes$2 = {
470
471
  action: PropTypes__default["default"].string,
471
472
  fields: core.PropTypes.fields,
472
473
  size: PropTypes__default["default"].string,
@@ -476,7 +477,7 @@ var propTypes$1 = {
476
477
  cancelLink: PropTypes__default["default"].string,
477
478
  cancelLabel: core.PropTypes.label
478
479
  };
479
- var defaultProps$1 = {
480
+ var defaultProps$2 = {
480
481
  action: '/user/two-factor-authentication',
481
482
  fields: null,
482
483
  size: 'lg',
@@ -514,7 +515,7 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
514
515
  var withCancelLink = _ref.withCancelLink,
515
516
  cancelLink = _ref.cancelLink,
516
517
  cancelLabel = _ref.cancelLabel,
517
- props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
518
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
518
519
 
519
520
  var defaultPostForm = React.useCallback(function (act, data) {
520
521
  return fetch.postJSON(act, data, {
@@ -534,11 +535,11 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
534
535
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
535
536
  };
536
537
 
537
- TwoFactorDisable.propTypes = propTypes$1;
538
- TwoFactorDisable.defaultProps = defaultProps$1;
538
+ TwoFactorDisable.propTypes = propTypes$2;
539
+ TwoFactorDisable.defaultProps = defaultProps$2;
539
540
 
540
- var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
541
- var propTypes = {
541
+ var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
542
+ var propTypes$1 = {
542
543
  action: PropTypes__default["default"].string,
543
544
  fields: core.PropTypes.fields,
544
545
  size: PropTypes__default["default"].string,
@@ -548,7 +549,7 @@ var propTypes = {
548
549
  skipLink: PropTypes__default["default"].string,
549
550
  skipLabel: core.PropTypes.label
550
551
  };
551
- var defaultProps = {
552
+ var defaultProps$1 = {
552
553
  action: '/user/two-factor-authentication',
553
554
  fields: null,
554
555
  size: 'lg',
@@ -586,7 +587,7 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
586
587
  var withSkipLink = _ref.withSkipLink,
587
588
  skipLink = _ref.skipLink,
588
589
  skipLabel = _ref.skipLabel,
589
- props = _objectWithoutProperties__default["default"](_ref, _excluded);
590
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
590
591
 
591
592
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
592
593
  action: action,
@@ -598,8 +599,88 @@ var TwoFactorEnable = function TwoFactorEnable(_ref) {
598
599
  }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
599
600
  };
600
601
 
601
- TwoFactorEnable.propTypes = propTypes;
602
- 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;
603
684
 
604
685
  exports.ConfirmPassword = ConfirmPassword;
605
686
  exports.ForgotPassword = ForgotPassword;
@@ -609,3 +690,4 @@ exports.ResetPassword = ResetPassword;
609
690
  exports.TwoFactorChallenge = TwoFactorChallenge;
610
691
  exports.TwoFactorDisable = TwoFactorDisable;
611
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.245",
3
+ "version": "1.0.0-alpha.248",
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": "ca53954d9fb21da822f712bbdd81412c20f90816"
62
62
  }