@panneau/form-auth 3.0.307 → 4.0.0

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 (2) hide show
  1. package/es/index.js +365 -494
  2. package/package.json +7 -7
package/es/index.js CHANGED
@@ -1,63 +1,26 @@
1
1
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
- import { PropTypes } from '@panneau/core';
3
- import Form from '@panneau/form';
4
- import PropTypes$1 from 'prop-types';
5
2
  import React, { useCallback } from 'react';
6
3
  import { FormattedMessage } from 'react-intl';
4
+ import Form from '@panneau/form';
7
5
  import Link from '@panneau/element-link';
8
6
  import { postJSON, getCSRFHeaders } from '@folklore/fetch';
9
7
 
10
8
  var _excluded$8 = ["action", "fields", "size", "currentPasswordLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
11
- var propTypes$8 = {
12
- action: PropTypes$1.string,
13
- fields: PropTypes.fields,
14
- size: PropTypes$1.string,
15
- currentPasswordLabel: PropTypes.label,
16
- passwordLabel: PropTypes.label,
17
- passwordConfirmationLabel: PropTypes.label,
18
- submitButtonLabel: PropTypes.label
19
- };
20
- var defaultProps$8 = {
21
- action: '/user/password',
22
- fields: null,
23
- size: 'lg',
24
- currentPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
25
- id: "8LSb8C",
26
- defaultMessage: [{
27
- "type": 0,
28
- "value": "Current password"
29
- }]
30
- }),
31
- passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
32
- id: "XJ1dc3",
33
- defaultMessage: [{
34
- "type": 0,
35
- "value": "New password"
36
- }]
37
- }),
38
- passwordConfirmationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
39
- id: "DUbv+u",
40
- defaultMessage: [{
41
- "type": 0,
42
- "value": "Confirm your new password"
43
- }]
44
- }),
45
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
46
- id: "XW9IKQ",
47
- defaultMessage: [{
48
- "type": 0,
49
- "value": "Update password"
50
- }]
51
- })
52
- };
53
- var ChangePassword = function ChangePassword(_ref) {
54
- var action = _ref.action,
55
- fields = _ref.fields,
56
- size = _ref.size,
57
- currentPasswordLabel = _ref.currentPasswordLabel,
58
- passwordLabel = _ref.passwordLabel,
59
- passwordConfirmationLabel = _ref.passwordConfirmationLabel,
60
- submitButtonLabel = _ref.submitButtonLabel,
9
+ function ChangePassword(_ref) {
10
+ var _ref$action = _ref.action,
11
+ action = _ref$action === void 0 ? '/user/password' : _ref$action,
12
+ _ref$fields = _ref.fields,
13
+ fields = _ref$fields === void 0 ? null : _ref$fields,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
16
+ _ref$currentPasswordL = _ref.currentPasswordLabel,
17
+ currentPasswordLabel = _ref$currentPasswordL === void 0 ? null : _ref$currentPasswordL,
18
+ _ref$passwordLabel = _ref.passwordLabel,
19
+ passwordLabel = _ref$passwordLabel === void 0 ? null : _ref$passwordLabel,
20
+ _ref$passwordConfirma = _ref.passwordConfirmationLabel,
21
+ passwordConfirmationLabel = _ref$passwordConfirma === void 0 ? null : _ref$passwordConfirma,
22
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
23
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
61
24
  props = _objectWithoutProperties(_ref, _excluded$8);
62
25
  return /*#__PURE__*/React.createElement(Form, Object.assign({
63
26
  action: action,
@@ -66,57 +29,58 @@ var ChangePassword = function ChangePassword(_ref) {
66
29
  name: 'current_password',
67
30
  type: 'password',
68
31
  size: size,
69
- label: currentPasswordLabel
32
+ label: currentPasswordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
33
+ id: "8LSb8C",
34
+ defaultMessage: [{
35
+ "type": 0,
36
+ "value": "Current password"
37
+ }]
38
+ })
70
39
  }, {
71
40
  name: 'password',
72
41
  type: 'password',
73
42
  size: size,
74
- label: passwordLabel
43
+ label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
44
+ id: "XJ1dc3",
45
+ defaultMessage: [{
46
+ "type": 0,
47
+ "value": "New password"
48
+ }]
49
+ })
75
50
  }, {
76
51
  name: 'password_confirmation',
77
52
  type: 'password',
78
53
  size: size,
79
- label: passwordConfirmationLabel
54
+ label: passwordConfirmationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
55
+ id: "DUbv+u",
56
+ defaultMessage: [{
57
+ "type": 0,
58
+ "value": "Confirm your new password"
59
+ }]
60
+ })
80
61
  }],
81
- submitButtonLabel: submitButtonLabel
62
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
63
+ id: "XW9IKQ",
64
+ defaultMessage: [{
65
+ "type": 0,
66
+ "value": "Update password"
67
+ }]
68
+ })
82
69
  }, props));
83
- };
84
- ChangePassword.propTypes = propTypes$8;
85
- ChangePassword.defaultProps = defaultProps$8;
70
+ }
86
71
 
87
72
  var _excluded$7 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
88
- var propTypes$7 = {
89
- action: PropTypes$1.string,
90
- fields: PropTypes.fields,
91
- size: PropTypes$1.string,
92
- passwordLabel: PropTypes.label,
93
- submitButtonLabel: PropTypes.label
94
- };
95
- var defaultProps$7 = {
96
- action: '/user/confirm-password',
97
- fields: null,
98
- size: 'lg',
99
- passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
100
- id: "B1h3gd",
101
- defaultMessage: [{
102
- "type": 0,
103
- "value": "Please enter your password to continue"
104
- }]
105
- }),
106
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
107
- id: "QUAHwy",
108
- defaultMessage: [{
109
- "type": 0,
110
- "value": "Continue"
111
- }]
112
- })
113
- };
114
- var ConfirmPassword = function ConfirmPassword(_ref) {
115
- var action = _ref.action,
116
- fields = _ref.fields,
117
- size = _ref.size,
118
- passwordLabel = _ref.passwordLabel,
119
- submitButtonLabel = _ref.submitButtonLabel,
73
+ function ConfirmPassword(_ref) {
74
+ var _ref$action = _ref.action,
75
+ action = _ref$action === void 0 ? '/user/confirm-password' : _ref$action,
76
+ _ref$fields = _ref.fields,
77
+ fields = _ref$fields === void 0 ? null : _ref$fields,
78
+ _ref$size = _ref.size,
79
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
80
+ _ref$passwordLabel = _ref.passwordLabel,
81
+ passwordLabel = _ref$passwordLabel === void 0 ? null : _ref$passwordLabel,
82
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
83
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
120
84
  props = _objectWithoutProperties(_ref, _excluded$7);
121
85
  return /*#__PURE__*/React.createElement(Form, Object.assign({
122
86
  action: action,
@@ -124,62 +88,42 @@ var ConfirmPassword = function ConfirmPassword(_ref) {
124
88
  name: 'password',
125
89
  type: 'password',
126
90
  size: size,
127
- label: passwordLabel
91
+ label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
92
+ id: "B1h3gd",
93
+ defaultMessage: [{
94
+ "type": 0,
95
+ "value": "Please enter your password to continue"
96
+ }]
97
+ })
128
98
  }],
129
- submitButtonLabel: submitButtonLabel
99
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
100
+ id: "QUAHwy",
101
+ defaultMessage: [{
102
+ "type": 0,
103
+ "value": "Continue"
104
+ }]
105
+ })
130
106
  }, props));
131
- };
132
- ConfirmPassword.propTypes = propTypes$7;
133
- ConfirmPassword.defaultProps = defaultProps$7;
107
+ }
134
108
 
135
109
  var _excluded$6 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
136
- var propTypes$6 = {
137
- action: PropTypes$1.string,
138
- fields: PropTypes.fields,
139
- size: PropTypes$1.string,
140
- emailLabel: PropTypes.label,
141
- submitButtonLabel: PropTypes.label,
142
- withLoginLink: PropTypes$1.bool,
143
- loginLink: PropTypes$1.string,
144
- loginLabel: PropTypes.label
145
- };
146
- var defaultProps$6 = {
147
- action: '/forgot-password',
148
- fields: null,
149
- size: 'lg',
150
- emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
151
- id: "LI0Gz4",
152
- defaultMessage: [{
153
- "type": 0,
154
- "value": "Email"
155
- }]
156
- }),
157
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
158
- id: "12Px0g",
159
- defaultMessage: [{
160
- "type": 0,
161
- "value": "Send reset link"
162
- }]
163
- }),
164
- withLoginLink: true,
165
- loginLink: '/login',
166
- loginLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
167
- id: "tPeIKO",
168
- defaultMessage: [{
169
- "type": 0,
170
- "value": "Go back to login"
171
- }]
172
- })
173
- };
174
- var ForgotPassword = function ForgotPassword(_ref) {
175
- var action = _ref.action,
176
- fields = _ref.fields,
177
- emailLabel = _ref.emailLabel,
178
- submitButtonLabel = _ref.submitButtonLabel,
179
- size = _ref.size,
180
- withLoginLink = _ref.withLoginLink,
181
- loginLink = _ref.loginLink,
182
- loginLabel = _ref.loginLabel,
110
+ function ForgotPassword(_ref) {
111
+ var _ref$action = _ref.action,
112
+ action = _ref$action === void 0 ? '/forgot-password' : _ref$action,
113
+ _ref$fields = _ref.fields,
114
+ fields = _ref$fields === void 0 ? null : _ref$fields,
115
+ _ref$emailLabel = _ref.emailLabel,
116
+ emailLabel = _ref$emailLabel === void 0 ? null : _ref$emailLabel,
117
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
118
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
119
+ _ref$size = _ref.size,
120
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
121
+ _ref$withLoginLink = _ref.withLoginLink,
122
+ withLoginLink = _ref$withLoginLink === void 0 ? true : _ref$withLoginLink,
123
+ _ref$loginLink = _ref.loginLink,
124
+ loginLink = _ref$loginLink === void 0 ? '/login' : _ref$loginLink,
125
+ _ref$loginLabel = _ref.loginLabel,
126
+ loginLabel = _ref$loginLabel === void 0 ? null : _ref$loginLabel,
183
127
  props = _objectWithoutProperties(_ref, _excluded$6);
184
128
  return /*#__PURE__*/React.createElement(Form, Object.assign({
185
129
  action: action,
@@ -187,78 +131,56 @@ var ForgotPassword = function ForgotPassword(_ref) {
187
131
  name: 'email',
188
132
  type: 'email',
189
133
  size: size,
190
- label: emailLabel
134
+ label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
135
+ id: "LI0Gz4",
136
+ defaultMessage: [{
137
+ "type": 0,
138
+ "value": "Email"
139
+ }]
140
+ })
191
141
  }],
192
- submitButtonLabel: submitButtonLabel,
142
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
143
+ id: "12Px0g",
144
+ defaultMessage: [{
145
+ "type": 0,
146
+ "value": "Send reset link"
147
+ }]
148
+ }),
193
149
  actions: withLoginLink ? /*#__PURE__*/React.createElement(Link, {
194
150
  href: loginLink,
195
151
  className: "py-2 px-4"
196
- }, loginLabel) : null
152
+ }, loginLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
153
+ id: "tPeIKO",
154
+ defaultMessage: [{
155
+ "type": 0,
156
+ "value": "Go back to login"
157
+ }]
158
+ })) : null
197
159
  }, props));
198
- };
199
- ForgotPassword.propTypes = propTypes$6;
200
- ForgotPassword.defaultProps = defaultProps$6;
160
+ }
201
161
 
202
162
  var _excluded$5 = ["action", "postForm", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
203
- var propTypes$5 = {
204
- action: PropTypes$1.string,
205
- postForm: PropTypes$1.func,
206
- fields: PropTypes.fields,
207
- size: PropTypes$1.string,
208
- emailLabel: PropTypes.label,
209
- passwordLabel: PropTypes.label,
210
- submitButtonLabel: PropTypes.label,
211
- withForgotPassword: PropTypes$1.bool,
212
- forgotPasswordLink: PropTypes$1.string,
213
- forgotPasswordLabel: PropTypes.label
214
- };
215
- var defaultProps$5 = {
216
- action: '/login',
217
- postForm: null,
218
- fields: null,
219
- size: 'lg',
220
- emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
221
- id: "LI0Gz4",
222
- defaultMessage: [{
223
- "type": 0,
224
- "value": "Email"
225
- }]
226
- }),
227
- passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
228
- id: "4yfet+",
229
- defaultMessage: [{
230
- "type": 0,
231
- "value": "Password"
232
- }]
233
- }),
234
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
235
- id: "g6qbbX",
236
- defaultMessage: [{
237
- "type": 0,
238
- "value": "Log in"
239
- }]
240
- }),
241
- withForgotPassword: false,
242
- forgotPasswordLink: '/forgot-password',
243
- forgotPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
244
- id: "ZBNqY2",
245
- defaultMessage: [{
246
- "type": 0,
247
- "value": "Forgot your password?"
248
- }]
249
- })
250
- };
251
- var Login = function Login(_ref) {
252
- var action = _ref.action,
253
- postForm = _ref.postForm,
254
- fields = _ref.fields,
255
- size = _ref.size,
256
- emailLabel = _ref.emailLabel,
257
- passwordLabel = _ref.passwordLabel,
258
- submitButtonLabel = _ref.submitButtonLabel,
259
- withForgotPassword = _ref.withForgotPassword,
260
- forgotPasswordLink = _ref.forgotPasswordLink,
261
- forgotPasswordLabel = _ref.forgotPasswordLabel,
163
+ function Login(_ref) {
164
+ var _ref$action = _ref.action,
165
+ action = _ref$action === void 0 ? '/login' : _ref$action,
166
+ _ref$postForm = _ref.postForm,
167
+ postForm = _ref$postForm === void 0 ? null : _ref$postForm,
168
+ _ref$fields = _ref.fields,
169
+ fields = _ref$fields === void 0 ? null : _ref$fields,
170
+ _ref$size = _ref.size,
171
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
172
+ _ref$emailLabel = _ref.emailLabel,
173
+ emailLabel = _ref$emailLabel === void 0 ? null : _ref$emailLabel,
174
+ _ref$passwordLabel = _ref.passwordLabel,
175
+ passwordLabel = _ref$passwordLabel === void 0 ? null : _ref$passwordLabel,
176
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
177
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
178
+ _ref$withForgotPasswo = _ref.withForgotPassword,
179
+ withForgotPassword = _ref$withForgotPasswo === void 0 ? false : _ref$withForgotPasswo,
180
+ _ref$forgotPasswordLi = _ref.forgotPasswordLink,
181
+ forgotPasswordLink = _ref$forgotPasswordLi === void 0 ? '/forgot-password' : _ref$forgotPasswordLi,
182
+ _ref$forgotPasswordLa = _ref.forgotPasswordLabel,
183
+ forgotPasswordLabel = _ref$forgotPasswordLa === void 0 ? null : _ref$forgotPasswordLa,
262
184
  props = _objectWithoutProperties(_ref, _excluded$5);
263
185
  return /*#__PURE__*/React.createElement(Form, Object.assign({
264
186
  action: action,
@@ -267,98 +189,69 @@ var Login = function Login(_ref) {
267
189
  name: 'email',
268
190
  type: 'email',
269
191
  size: size,
270
- label: emailLabel
192
+ label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
193
+ id: "LI0Gz4",
194
+ defaultMessage: [{
195
+ "type": 0,
196
+ "value": "Email"
197
+ }]
198
+ })
271
199
  }, {
272
200
  name: 'password',
273
201
  type: 'password',
274
202
  size: size,
275
- label: passwordLabel
203
+ label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
204
+ id: "4yfet+",
205
+ defaultMessage: [{
206
+ "type": 0,
207
+ "value": "Password"
208
+ }]
209
+ })
276
210
  }],
277
- submitButtonLabel: submitButtonLabel,
211
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
212
+ id: "g6qbbX",
213
+ defaultMessage: [{
214
+ "type": 0,
215
+ "value": "Log in"
216
+ }]
217
+ }),
278
218
  actions: withForgotPassword ? /*#__PURE__*/React.createElement(Link, {
279
219
  href: forgotPasswordLink,
280
220
  className: "py-2 px-4"
281
- }, forgotPasswordLabel) : null
221
+ }, forgotPasswordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
222
+ id: "ZBNqY2",
223
+ defaultMessage: [{
224
+ "type": 0,
225
+ "value": "Forgot your password?"
226
+ }]
227
+ })) : null
282
228
  }, props));
283
- };
284
- Login.propTypes = propTypes$5;
285
- Login.defaultProps = defaultProps$5;
229
+ }
286
230
 
287
231
  var _excluded$4 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
288
- var propTypes$4 = {
289
- action: PropTypes$1.string,
290
- fields: PropTypes.fields,
291
- size: PropTypes$1.string,
292
- nameLabel: PropTypes.label,
293
- emailLabel: PropTypes.label,
294
- passwordLabel: PropTypes.label,
295
- passwordConfirmationLabel: PropTypes.label,
296
- submitButtonLabel: PropTypes.label,
297
- withLoginLink: PropTypes$1.bool,
298
- loginLink: PropTypes$1.string,
299
- loginLabel: PropTypes.label
300
- };
301
- var defaultProps$4 = {
302
- action: '/register',
303
- fields: null,
304
- size: 'lg',
305
- nameLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
306
- id: "UUv8FR",
307
- defaultMessage: [{
308
- "type": 0,
309
- "value": "Name"
310
- }]
311
- }),
312
- emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
313
- id: "LI0Gz4",
314
- defaultMessage: [{
315
- "type": 0,
316
- "value": "Email"
317
- }]
318
- }),
319
- passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
320
- id: "4yfet+",
321
- defaultMessage: [{
322
- "type": 0,
323
- "value": "Password"
324
- }]
325
- }),
326
- passwordConfirmationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
327
- id: "VhJUeW",
328
- defaultMessage: [{
329
- "type": 0,
330
- "value": "Confirm your password"
331
- }]
332
- }),
333
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
334
- id: "PQX/ph",
335
- defaultMessage: [{
336
- "type": 0,
337
- "value": "Create account"
338
- }]
339
- }),
340
- withLoginLink: true,
341
- loginLink: '/login',
342
- loginLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
343
- id: "wa783M",
344
- defaultMessage: [{
345
- "type": 0,
346
- "value": "Already have an account? Go to login"
347
- }]
348
- })
349
- };
350
- var Register = function Register(_ref) {
351
- var action = _ref.action,
352
- fields = _ref.fields,
353
- size = _ref.size,
354
- nameLabel = _ref.nameLabel,
355
- emailLabel = _ref.emailLabel,
356
- passwordLabel = _ref.passwordLabel,
357
- passwordConfirmationLabel = _ref.passwordConfirmationLabel,
358
- submitButtonLabel = _ref.submitButtonLabel,
359
- withLoginLink = _ref.withLoginLink,
360
- loginLink = _ref.loginLink,
361
- loginLabel = _ref.loginLabel,
232
+ function Register(_ref) {
233
+ var _ref$action = _ref.action,
234
+ action = _ref$action === void 0 ? '/register' : _ref$action,
235
+ _ref$fields = _ref.fields,
236
+ fields = _ref$fields === void 0 ? null : _ref$fields,
237
+ _ref$size = _ref.size,
238
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
239
+ _ref$nameLabel = _ref.nameLabel,
240
+ nameLabel = _ref$nameLabel === void 0 ? null : _ref$nameLabel,
241
+ _ref$emailLabel = _ref.emailLabel,
242
+ emailLabel = _ref$emailLabel === void 0 ? null : _ref$emailLabel,
243
+ _ref$passwordLabel = _ref.passwordLabel,
244
+ passwordLabel = _ref$passwordLabel === void 0 ? null : _ref$passwordLabel,
245
+ _ref$passwordConfirma = _ref.passwordConfirmationLabel,
246
+ passwordConfirmationLabel = _ref$passwordConfirma === void 0 ? null : _ref$passwordConfirma,
247
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
248
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
249
+ _ref$withLoginLink = _ref.withLoginLink,
250
+ withLoginLink = _ref$withLoginLink === void 0 ? true : _ref$withLoginLink,
251
+ _ref$loginLink = _ref.loginLink,
252
+ loginLink = _ref$loginLink === void 0 ? '/login' : _ref$loginLink,
253
+ _ref$loginLabel = _ref.loginLabel,
254
+ loginLabel = _ref$loginLabel === void 0 ? null : _ref$loginLabel,
362
255
  props = _objectWithoutProperties(_ref, _excluded$4);
363
256
  return /*#__PURE__*/React.createElement(Form, Object.assign({
364
257
  action: action,
@@ -366,84 +259,83 @@ var Register = function Register(_ref) {
366
259
  name: 'name',
367
260
  type: 'text',
368
261
  size: size,
369
- label: nameLabel
262
+ label: nameLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
263
+ id: "UUv8FR",
264
+ defaultMessage: [{
265
+ "type": 0,
266
+ "value": "Name"
267
+ }]
268
+ })
370
269
  }, {
371
270
  name: 'email',
372
271
  type: 'email',
373
272
  size: size,
374
- label: emailLabel
273
+ label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
274
+ id: "LI0Gz4",
275
+ defaultMessage: [{
276
+ "type": 0,
277
+ "value": "Email"
278
+ }]
279
+ })
375
280
  }, {
376
281
  name: 'password',
377
282
  type: 'password',
378
283
  size: size,
379
- label: passwordLabel
284
+ label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
285
+ id: "4yfet+",
286
+ defaultMessage: [{
287
+ "type": 0,
288
+ "value": "Password"
289
+ }]
290
+ })
380
291
  }, {
381
292
  name: 'password_confirmation',
382
293
  type: 'password',
383
294
  size: size,
384
- label: passwordConfirmationLabel
295
+ label: passwordConfirmationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
296
+ id: "VhJUeW",
297
+ defaultMessage: [{
298
+ "type": 0,
299
+ "value": "Confirm your password"
300
+ }]
301
+ })
385
302
  }],
386
- submitButtonLabel: submitButtonLabel,
303
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
304
+ id: "PQX/ph",
305
+ defaultMessage: [{
306
+ "type": 0,
307
+ "value": "Create account"
308
+ }]
309
+ }),
387
310
  actions: withLoginLink ? /*#__PURE__*/React.createElement(Link, {
388
311
  href: loginLink,
389
312
  className: "py-2 px-4"
390
- }, loginLabel) : null
313
+ }, loginLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
314
+ id: "wa783M",
315
+ defaultMessage: [{
316
+ "type": 0,
317
+ "value": "Already have an account? Go to login"
318
+ }]
319
+ })) : null
391
320
  }, props));
392
- };
393
- Register.propTypes = propTypes$4;
394
- Register.defaultProps = defaultProps$4;
321
+ }
395
322
 
396
323
  var _excluded$3 = ["action", "fields", "size", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
397
- var propTypes$3 = {
398
- action: PropTypes$1.string,
399
- fields: PropTypes.fields,
400
- size: PropTypes$1.string,
401
- emailLabel: PropTypes.label,
402
- passwordLabel: PropTypes.label,
403
- passwordConfirmationLabel: PropTypes.label,
404
- submitButtonLabel: PropTypes.label
405
- };
406
- var defaultProps$3 = {
407
- action: '/reset-password',
408
- fields: null,
409
- size: 'lg',
410
- emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
411
- id: "LI0Gz4",
412
- defaultMessage: [{
413
- "type": 0,
414
- "value": "Email"
415
- }]
416
- }),
417
- passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
418
- id: "4yfet+",
419
- defaultMessage: [{
420
- "type": 0,
421
- "value": "Password"
422
- }]
423
- }),
424
- passwordConfirmationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
425
- id: "VhJUeW",
426
- defaultMessage: [{
427
- "type": 0,
428
- "value": "Confirm your password"
429
- }]
430
- }),
431
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
432
- id: "zwks3g",
433
- defaultMessage: [{
434
- "type": 0,
435
- "value": "Save new password"
436
- }]
437
- })
438
- };
439
- var ResetPassword = function ResetPassword(_ref) {
440
- var action = _ref.action,
441
- fields = _ref.fields,
442
- size = _ref.size,
443
- emailLabel = _ref.emailLabel,
444
- passwordLabel = _ref.passwordLabel,
445
- passwordConfirmationLabel = _ref.passwordConfirmationLabel,
446
- submitButtonLabel = _ref.submitButtonLabel,
324
+ function ResetPassword(_ref) {
325
+ var _ref$action = _ref.action,
326
+ action = _ref$action === void 0 ? '/reset-password' : _ref$action,
327
+ _ref$fields = _ref.fields,
328
+ fields = _ref$fields === void 0 ? null : _ref$fields,
329
+ _ref$size = _ref.size,
330
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
331
+ _ref$emailLabel = _ref.emailLabel,
332
+ emailLabel = _ref$emailLabel === void 0 ? null : _ref$emailLabel,
333
+ _ref$passwordLabel = _ref.passwordLabel,
334
+ passwordLabel = _ref$passwordLabel === void 0 ? null : _ref$passwordLabel,
335
+ _ref$passwordConfirma = _ref.passwordConfirmationLabel,
336
+ passwordConfirmationLabel = _ref$passwordConfirma === void 0 ? null : _ref$passwordConfirma,
337
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
338
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
447
339
  props = _objectWithoutProperties(_ref, _excluded$3);
448
340
  return /*#__PURE__*/React.createElement(Form, Object.assign({
449
341
  action: action,
@@ -451,58 +343,59 @@ var ResetPassword = function ResetPassword(_ref) {
451
343
  name: 'email',
452
344
  type: 'email',
453
345
  size: size,
454
- label: emailLabel,
346
+ label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
347
+ id: "LI0Gz4",
348
+ defaultMessage: [{
349
+ "type": 0,
350
+ "value": "Email"
351
+ }]
352
+ }),
455
353
  readOnly: true
456
354
  }, {
457
355
  name: 'password',
458
356
  type: 'password',
459
357
  size: size,
460
- label: passwordLabel
358
+ label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
359
+ id: "4yfet+",
360
+ defaultMessage: [{
361
+ "type": 0,
362
+ "value": "Password"
363
+ }]
364
+ })
461
365
  }, {
462
366
  name: 'password_confirmation',
463
367
  type: 'password',
464
368
  size: size,
465
- label: passwordConfirmationLabel
369
+ label: passwordConfirmationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
370
+ id: "VhJUeW",
371
+ defaultMessage: [{
372
+ "type": 0,
373
+ "value": "Confirm your password"
374
+ }]
375
+ })
466
376
  }],
467
- submitButtonLabel: submitButtonLabel
377
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
378
+ id: "zwks3g",
379
+ defaultMessage: [{
380
+ "type": 0,
381
+ "value": "Save new password"
382
+ }]
383
+ })
468
384
  }, props));
469
- };
470
- ResetPassword.propTypes = propTypes$3;
471
- ResetPassword.defaultProps = defaultProps$3;
385
+ }
472
386
 
473
387
  var _excluded$2 = ["action", "fields", "size", "codeLabel", "submitButtonLabel"];
474
- var propTypes$2 = {
475
- action: PropTypes$1.string,
476
- fields: PropTypes.fields,
477
- size: PropTypes$1.string,
478
- codeLabel: PropTypes.label,
479
- submitButtonLabel: PropTypes.label
480
- };
481
- var defaultProps$2 = {
482
- action: '/two-factor-challenge',
483
- fields: null,
484
- size: 'lg',
485
- codeLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
486
- id: "22Ld5M",
487
- defaultMessage: [{
488
- "type": 0,
489
- "value": "Enter the code from your authenticator app to continue"
490
- }]
491
- }),
492
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
493
- id: "QUAHwy",
494
- defaultMessage: [{
495
- "type": 0,
496
- "value": "Continue"
497
- }]
498
- })
499
- };
500
- var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
501
- var action = _ref.action,
502
- fields = _ref.fields,
503
- size = _ref.size,
504
- codeLabel = _ref.codeLabel,
505
- submitButtonLabel = _ref.submitButtonLabel,
388
+ function TwoFactorChallenge(_ref) {
389
+ var _ref$action = _ref.action,
390
+ action = _ref$action === void 0 ? '/two-factor-challenge' : _ref$action,
391
+ _ref$fields = _ref.fields,
392
+ fields = _ref$fields === void 0 ? null : _ref$fields,
393
+ _ref$size = _ref.size,
394
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
395
+ _ref$codeLabel = _ref.codeLabel,
396
+ codeLabel = _ref$codeLabel === void 0 ? null : _ref$codeLabel,
397
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
398
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
506
399
  props = _objectWithoutProperties(_ref, _excluded$2);
507
400
  return /*#__PURE__*/React.createElement(Form, Object.assign({
508
401
  action: action,
@@ -510,62 +403,40 @@ var TwoFactorChallenge = function TwoFactorChallenge(_ref) {
510
403
  name: 'code',
511
404
  type: 'text',
512
405
  size: size,
513
- label: codeLabel
406
+ label: codeLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
407
+ id: "22Ld5M",
408
+ defaultMessage: [{
409
+ "type": 0,
410
+ "value": "Enter the code from your authenticator app to continue"
411
+ }]
412
+ })
514
413
  }],
515
- submitButtonLabel: submitButtonLabel
414
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
415
+ id: "QUAHwy",
416
+ defaultMessage: [{
417
+ "type": 0,
418
+ "value": "Continue"
419
+ }]
420
+ })
516
421
  }, props));
517
- };
518
- TwoFactorChallenge.propTypes = propTypes$2;
519
- TwoFactorChallenge.defaultProps = defaultProps$2;
422
+ }
520
423
 
521
424
  var _excluded$1 = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withCancelLink", "cancelLink", "cancelLabel"];
522
- var propTypes$1 = {
523
- action: PropTypes$1.string,
524
- fields: PropTypes.fields,
525
- size: PropTypes$1.string,
526
- explainationLabel: PropTypes.label,
527
- submitButtonLabel: PropTypes.label,
528
- withCancelLink: PropTypes$1.bool,
529
- cancelLink: PropTypes$1.string,
530
- cancelLabel: PropTypes.label
531
- };
532
- var defaultProps$1 = {
533
- action: '/user/two-factor-authentication',
534
- fields: null,
535
- size: 'lg',
536
- explainationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
537
- id: "5nHK/H",
538
- defaultMessage: [{
539
- "type": 0,
540
- "value": "Do you really wish to disable two factor authentication on your account?"
541
- }]
542
- }),
543
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
544
- id: "gWmL5V",
545
- defaultMessage: [{
546
- "type": 0,
547
- "value": "Disable two factor authentication"
548
- }]
549
- }),
550
- withCancelLink: true,
551
- cancelLink: '/home',
552
- cancelLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
553
- id: "U/ye2x",
554
- defaultMessage: [{
555
- "type": 0,
556
- "value": "Cancel"
557
- }]
558
- })
559
- };
560
- var TwoFactorDisable = function TwoFactorDisable(_ref) {
561
- var action = _ref.action;
425
+ function TwoFactorDisable(_ref) {
426
+ var _ref$action = _ref.action,
427
+ action = _ref$action === void 0 ? '/user/two-factor-authentication' : _ref$action;
562
428
  _ref.fields;
563
- var explainationLabel = _ref.explainationLabel,
564
- submitButtonLabel = _ref.submitButtonLabel;
429
+ var _ref$explainationLabe = _ref.explainationLabel,
430
+ explainationLabel = _ref$explainationLabe === void 0 ? null : _ref$explainationLabe,
431
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
432
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe;
565
433
  _ref.size;
566
- var withCancelLink = _ref.withCancelLink,
567
- cancelLink = _ref.cancelLink,
568
- cancelLabel = _ref.cancelLabel,
434
+ var _ref$withCancelLink = _ref.withCancelLink,
435
+ withCancelLink = _ref$withCancelLink === void 0 ? true : _ref$withCancelLink,
436
+ _ref$cancelLink = _ref.cancelLink,
437
+ cancelLink = _ref$cancelLink === void 0 ? '/home' : _ref$cancelLink,
438
+ _ref$cancelLabel = _ref.cancelLabel,
439
+ cancelLabel = _ref$cancelLabel === void 0 ? null : _ref$cancelLabel,
569
440
  props = _objectWithoutProperties(_ref, _excluded$1);
570
441
  var defaultPostForm = useCallback(function (act, data) {
571
442
  return postJSON(act, data, {
@@ -576,76 +447,76 @@ var TwoFactorDisable = function TwoFactorDisable(_ref) {
576
447
  }, []);
577
448
  return /*#__PURE__*/React.createElement(Form, Object.assign({
578
449
  action: action,
579
- submitButtonLabel: submitButtonLabel,
450
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
451
+ id: "gWmL5V",
452
+ defaultMessage: [{
453
+ "type": 0,
454
+ "value": "Disable two factor authentication"
455
+ }]
456
+ }),
580
457
  actions: withCancelLink ? /*#__PURE__*/React.createElement(Link, {
581
458
  className: "py-2 px-4",
582
459
  href: cancelLink
583
- }, cancelLabel) : null,
460
+ }, cancelLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
461
+ id: "U/ye2x",
462
+ defaultMessage: [{
463
+ "type": 0,
464
+ "value": "Cancel"
465
+ }]
466
+ })) : null,
584
467
  postForm: defaultPostForm
585
- }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
586
- };
587
- TwoFactorDisable.propTypes = propTypes$1;
588
- TwoFactorDisable.defaultProps = defaultProps$1;
589
-
590
- var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
591
- var propTypes = {
592
- action: PropTypes$1.string,
593
- fields: PropTypes.fields,
594
- size: PropTypes$1.string,
595
- explainationLabel: PropTypes.label,
596
- submitButtonLabel: PropTypes.label,
597
- withSkipLink: PropTypes$1.bool,
598
- skipLink: PropTypes$1.string,
599
- skipLabel: PropTypes.label
600
- };
601
- var defaultProps = {
602
- action: '/user/two-factor-authentication',
603
- fields: null,
604
- size: 'lg',
605
- explainationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
606
- id: "zTiC4D",
607
- defaultMessage: [{
608
- "type": 0,
609
- "value": "Do you wish to enable two factor authentication on your account? You will have to use an authentication app such as Google Authenticator or Microsoft Authenticator in addition to your password to connect."
610
- }]
611
- }),
612
- submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
613
- id: "pVHYDd",
614
- defaultMessage: [{
615
- "type": 0,
616
- "value": "Enable two factor authentication"
617
- }]
618
- }),
619
- withSkipLink: true,
620
- skipLink: '/home',
621
- skipLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
622
- id: "li2Qqu",
468
+ }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
469
+ id: "5nHK/H",
623
470
  defaultMessage: [{
624
471
  "type": 0,
625
- "value": "Skip setup"
472
+ "value": "Do you really wish to disable two factor authentication on your account?"
626
473
  }]
627
- })
628
- };
629
- var TwoFactorEnable = function TwoFactorEnable(_ref) {
630
- var action = _ref.action;
474
+ })));
475
+ }
476
+
477
+ var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
478
+ function TwoFactorEnable(_ref) {
479
+ var _ref$action = _ref.action,
480
+ action = _ref$action === void 0 ? '/user/two-factor-authentication' : _ref$action;
631
481
  _ref.fields;
632
- var explainationLabel = _ref.explainationLabel,
633
- submitButtonLabel = _ref.submitButtonLabel;
482
+ var _ref$explainationLabe = _ref.explainationLabel,
483
+ explainationLabel = _ref$explainationLabe === void 0 ? null : _ref$explainationLabe,
484
+ _ref$submitButtonLabe = _ref.submitButtonLabel,
485
+ submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe;
634
486
  _ref.size;
635
- var withSkipLink = _ref.withSkipLink,
636
- skipLink = _ref.skipLink,
637
- skipLabel = _ref.skipLabel,
487
+ var _ref$withSkipLink = _ref.withSkipLink,
488
+ withSkipLink = _ref$withSkipLink === void 0 ? true : _ref$withSkipLink,
489
+ _ref$skipLink = _ref.skipLink,
490
+ skipLink = _ref$skipLink === void 0 ? '/home' : _ref$skipLink,
491
+ _ref$skipLabel = _ref.skipLabel,
492
+ skipLabel = _ref$skipLabel === void 0 ? null : _ref$skipLabel,
638
493
  props = _objectWithoutProperties(_ref, _excluded);
639
494
  return /*#__PURE__*/React.createElement(Form, Object.assign({
640
495
  action: action,
641
- submitButtonLabel: submitButtonLabel,
496
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
497
+ id: "pVHYDd",
498
+ defaultMessage: [{
499
+ "type": 0,
500
+ "value": "Enable two factor authentication"
501
+ }]
502
+ }),
642
503
  actions: withSkipLink ? /*#__PURE__*/React.createElement(Link, {
643
504
  className: "py-2 px-4",
644
505
  href: skipLink
645
- }, skipLabel) : null
646
- }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
647
- };
648
- TwoFactorEnable.propTypes = propTypes;
649
- TwoFactorEnable.defaultProps = defaultProps;
506
+ }, skipLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
507
+ id: "li2Qqu",
508
+ defaultMessage: [{
509
+ "type": 0,
510
+ "value": "Skip setup"
511
+ }]
512
+ })) : null
513
+ }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
514
+ id: "zTiC4D",
515
+ defaultMessage: [{
516
+ "type": 0,
517
+ "value": "Do you wish to enable two factor authentication on your account? You will have to use an authentication app such as Google Authenticator or Microsoft Authenticator in addition to your password to connect."
518
+ }]
519
+ })));
520
+ }
650
521
 
651
522
  export { ChangePassword, ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/form-auth",
3
- "version": "3.0.307",
3
+ "version": "4.0.0",
4
4
  "description": "Basic forgot password form",
5
5
  "keywords": [
6
6
  "javascript"
@@ -49,17 +49,17 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.12.5",
52
- "@folklore/fetch": "^0.1.17",
53
- "@panneau/core": "^3.0.307",
54
- "@panneau/element-link": "^3.0.307",
55
- "@panneau/form": "^3.0.307",
52
+ "@folklore/fetch": "^0.1.21",
53
+ "@panneau/core": "^4.0.0",
54
+ "@panneau/element-link": "^4.0.0",
55
+ "@panneau/form": "^4.0.0",
56
56
  "classnames": "^2.5.1",
57
57
  "lodash-es": "^4.17.21",
58
58
  "prop-types": "^15.7.2",
59
- "react-intl": "^5.15.8||^6.0.0"
59
+ "react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "cbe5e8b1705d01c5653a4df617a06243344310d3"
64
+ "gitHead": "2cca874e0388b4a20c39aadb205c0e67d5a946fc"
65
65
  }