@panneau/form-auth 1.0.0-alpha.238 → 1.0.0-alpha.242

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 +257 -28
  2. package/lib/index.js +260 -28
  3. package/package.json +4 -4
package/es/index.js CHANGED
@@ -6,9 +6,60 @@ import React from 'react';
6
6
  import { FormattedMessage } from 'react-intl';
7
7
  import { Link } from 'react-router-dom';
8
8
 
9
- var _excluded$2 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
10
- var propTypes$2 = {
11
- action: PropTypes.string.isRequired,
9
+ var _excluded$5 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
10
+ var propTypes$5 = {
11
+ action: PropTypes.string,
12
+ fields: PropTypes$1.fields,
13
+ size: PropTypes.string,
14
+ passwordLabel: PropTypes$1.label,
15
+ submitButtonLabel: PropTypes$1.label
16
+ };
17
+ var defaultProps$5 = {
18
+ action: '/user/confirm-password',
19
+ fields: null,
20
+ size: 'lg',
21
+ passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
22
+ id: "B1h3gd",
23
+ defaultMessage: [{
24
+ "type": 0,
25
+ "value": "Please enter your password to continue"
26
+ }]
27
+ }),
28
+ submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
29
+ id: "RRwdkV",
30
+ defaultMessage: [{
31
+ "type": 0,
32
+ "value": "Contnue"
33
+ }]
34
+ })
35
+ };
36
+
37
+ var ConfirmPassword = function ConfirmPassword(_ref) {
38
+ var action = _ref.action,
39
+ fields = _ref.fields,
40
+ size = _ref.size,
41
+ passwordLabel = _ref.passwordLabel,
42
+ submitButtonLabel = _ref.submitButtonLabel,
43
+ props = _objectWithoutProperties(_ref, _excluded$5);
44
+
45
+ return /*#__PURE__*/React.createElement(Form, Object.assign({
46
+ action: action,
47
+ fields: fields || [{
48
+ name: 'password',
49
+ type: 'password',
50
+ size: size,
51
+ label: passwordLabel
52
+ }],
53
+ submitButtonLabel: submitButtonLabel
54
+ }, props));
55
+ };
56
+
57
+ ConfirmPassword.propTypes = propTypes$5;
58
+ ConfirmPassword.defaultProps = defaultProps$5;
59
+
60
+ var _excluded$4 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
61
+ var propTypes$4 = {
62
+ action: PropTypes.string,
12
63
  fields: PropTypes$1.fields,
13
64
  size: PropTypes.string,
14
65
  emailLabel: PropTypes$1.label,
@@ -17,7 +68,8 @@ var propTypes$2 = {
17
68
  loginLink: PropTypes.string,
18
69
  loginLabel: PropTypes$1.label
19
70
  };
20
- var defaultProps$2 = {
71
+ var defaultProps$4 = {
72
+ action: '/forgot-password',
21
73
  fields: null,
22
74
  size: 'lg',
23
75
  emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -37,7 +89,7 @@ var defaultProps$2 = {
37
89
  withLoginLink: true,
38
90
  loginLink: '/login',
39
91
  loginLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
40
- id: "X4fQOn",
92
+ id: "tPeIKO",
41
93
  defaultMessage: [{
42
94
  "type": 0,
43
95
  "value": "Go back to login"
@@ -54,7 +106,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
54
106
  withLoginLink = _ref.withLoginLink,
55
107
  loginLink = _ref.loginLink,
56
108
  loginLabel = _ref.loginLabel,
57
- props = _objectWithoutProperties(_ref, _excluded$2);
109
+ props = _objectWithoutProperties(_ref, _excluded$4);
58
110
 
59
111
  return /*#__PURE__*/React.createElement(Form, Object.assign({
60
112
  action: action,
@@ -66,17 +118,17 @@ var ForgotPassword = function ForgotPassword(_ref) {
66
118
  }],
67
119
  submitButtonLabel: submitButtonLabel,
68
120
  actions: withLoginLink ? /*#__PURE__*/React.createElement(Link, {
69
- className: "py-2 px-5",
121
+ className: "py-2 px-4",
70
122
  to: loginLink
71
123
  }, loginLabel) : null
72
124
  }, props));
73
125
  };
74
126
 
75
- ForgotPassword.propTypes = propTypes$2;
76
- ForgotPassword.defaultProps = defaultProps$2;
127
+ ForgotPassword.propTypes = propTypes$4;
128
+ ForgotPassword.defaultProps = defaultProps$4;
77
129
 
78
- var _excluded$1 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
79
- var propTypes$1 = {
130
+ var _excluded$3 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
131
+ var propTypes$3 = {
80
132
  action: PropTypes.string,
81
133
  fields: PropTypes$1.fields,
82
134
  size: PropTypes.string,
@@ -87,7 +139,7 @@ var propTypes$1 = {
87
139
  forgotPasswordLink: PropTypes.string,
88
140
  forgotPasswordLabel: PropTypes$1.label
89
141
  };
90
- var defaultProps$1 = {
142
+ var defaultProps$3 = {
91
143
  action: '/login',
92
144
  fields: null,
93
145
  size: 'lg',
@@ -115,7 +167,7 @@ var defaultProps$1 = {
115
167
  withForgotPassword: true,
116
168
  forgotPasswordLink: '/forgot-password',
117
169
  forgotPasswordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
118
- id: "oKZDBl",
170
+ id: "ZBNqY2",
119
171
  defaultMessage: [{
120
172
  "type": 0,
121
173
  "value": "Forgot your password?"
@@ -123,7 +175,7 @@ var defaultProps$1 = {
123
175
  })
124
176
  };
125
177
 
126
- var LoginForm = function LoginForm(_ref) {
178
+ var Login = function Login(_ref) {
127
179
  var action = _ref.action,
128
180
  fields = _ref.fields,
129
181
  size = _ref.size,
@@ -133,7 +185,7 @@ var LoginForm = function LoginForm(_ref) {
133
185
  withForgotPassword = _ref.withForgotPassword,
134
186
  forgotPasswordLink = _ref.forgotPasswordLink,
135
187
  forgotPasswordLabel = _ref.forgotPasswordLabel,
136
- props = _objectWithoutProperties(_ref, _excluded$1);
188
+ props = _objectWithoutProperties(_ref, _excluded$3);
137
189
 
138
190
  return /*#__PURE__*/React.createElement(Form, Object.assign({
139
191
  action: action,
@@ -150,25 +202,138 @@ var LoginForm = function LoginForm(_ref) {
150
202
  }],
151
203
  submitButtonLabel: submitButtonLabel,
152
204
  actions: withForgotPassword ? /*#__PURE__*/React.createElement(Link, {
153
- className: "py-2 px-5",
205
+ className: "py-2 px-4",
154
206
  to: forgotPasswordLink
155
207
  }, forgotPasswordLabel) : null
156
208
  }, props));
157
209
  };
158
210
 
159
- LoginForm.propTypes = propTypes$1;
160
- LoginForm.defaultProps = defaultProps$1;
211
+ Login.propTypes = propTypes$3;
212
+ Login.defaultProps = defaultProps$3;
161
213
 
162
- var _excluded = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
163
- var propTypes = {
164
- action: PropTypes.string.isRequired,
214
+ var _excluded$2 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
215
+ var propTypes$2 = {
216
+ action: PropTypes.string,
217
+ fields: PropTypes$1.fields,
218
+ size: PropTypes.string,
219
+ nameLabel: PropTypes$1.label,
220
+ emailLabel: PropTypes$1.label,
221
+ passwordLabel: PropTypes$1.label,
222
+ passwordConfirmationLabel: PropTypes$1.label,
223
+ submitButtonLabel: PropTypes$1.label,
224
+ withLoginLink: PropTypes.bool,
225
+ loginLink: PropTypes.string,
226
+ loginLabel: PropTypes$1.label
227
+ };
228
+ var defaultProps$2 = {
229
+ action: '/register',
230
+ fields: null,
231
+ size: 'lg',
232
+ nameLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
233
+ id: "UUv8FR",
234
+ defaultMessage: [{
235
+ "type": 0,
236
+ "value": "Name"
237
+ }]
238
+ }),
239
+ emailLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
240
+ id: "LI0Gz4",
241
+ defaultMessage: [{
242
+ "type": 0,
243
+ "value": "Email"
244
+ }]
245
+ }),
246
+ passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
247
+ id: "4yfet+",
248
+ defaultMessage: [{
249
+ "type": 0,
250
+ "value": "Password"
251
+ }]
252
+ }),
253
+ passwordConfirmationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
254
+ id: "VhJUeW",
255
+ defaultMessage: [{
256
+ "type": 0,
257
+ "value": "Confirm your password"
258
+ }]
259
+ }),
260
+ submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
261
+ id: "PQX/ph",
262
+ defaultMessage: [{
263
+ "type": 0,
264
+ "value": "Create account"
265
+ }]
266
+ }),
267
+ withLoginLink: true,
268
+ loginLink: '/forgot-password',
269
+ loginLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
270
+ id: "wa783M",
271
+ defaultMessage: [{
272
+ "type": 0,
273
+ "value": "Already have an account? Go to login"
274
+ }]
275
+ })
276
+ };
277
+
278
+ var Register = function Register(_ref) {
279
+ var action = _ref.action,
280
+ fields = _ref.fields,
281
+ size = _ref.size,
282
+ nameLabel = _ref.nameLabel,
283
+ emailLabel = _ref.emailLabel,
284
+ passwordLabel = _ref.passwordLabel,
285
+ passwordConfirmationLabel = _ref.passwordConfirmationLabel,
286
+ submitButtonLabel = _ref.submitButtonLabel,
287
+ withLoginLink = _ref.withLoginLink,
288
+ loginLink = _ref.loginLink,
289
+ loginLabel = _ref.loginLabel,
290
+ props = _objectWithoutProperties(_ref, _excluded$2);
291
+
292
+ return /*#__PURE__*/React.createElement(Form, Object.assign({
293
+ action: action,
294
+ fields: fields || [{
295
+ name: 'name',
296
+ type: 'text',
297
+ size: size,
298
+ label: nameLabel
299
+ }, {
300
+ name: 'email',
301
+ type: 'email',
302
+ size: size,
303
+ label: emailLabel
304
+ }, {
305
+ name: 'password',
306
+ type: 'password',
307
+ size: size,
308
+ label: passwordLabel
309
+ }, {
310
+ name: 'password_confirmation',
311
+ type: 'password',
312
+ size: size,
313
+ label: passwordConfirmationLabel
314
+ }],
315
+ submitButtonLabel: submitButtonLabel,
316
+ actions: withLoginLink ? /*#__PURE__*/React.createElement(Link, {
317
+ className: "py-2 px-4",
318
+ to: loginLink
319
+ }, loginLabel) : null
320
+ }, props));
321
+ };
322
+
323
+ Register.propTypes = propTypes$2;
324
+ Register.defaultProps = defaultProps$2;
325
+
326
+ var _excluded$1 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
327
+ var propTypes$1 = {
328
+ action: PropTypes.string,
165
329
  fields: PropTypes$1.fields,
166
330
  size: PropTypes.string,
167
331
  passwordLabel: PropTypes$1.label,
168
332
  passwordConfirmationLabel: PropTypes$1.label,
169
333
  submitButtonLabel: PropTypes$1.label
170
334
  };
171
- var defaultProps = {
335
+ var defaultProps$1 = {
336
+ action: '/reset-password',
172
337
  fields: null,
173
338
  size: 'lg',
174
339
  passwordLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -179,10 +344,10 @@ var defaultProps = {
179
344
  }]
180
345
  }),
181
346
  passwordConfirmationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
182
- id: "SdtI90",
347
+ id: "VhJUeW",
183
348
  defaultMessage: [{
184
349
  "type": 0,
185
- "value": "Password confirmation"
350
+ "value": "Confirm your password"
186
351
  }]
187
352
  }),
188
353
  submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -201,7 +366,7 @@ var ResetPassword = function ResetPassword(_ref) {
201
366
  passwordLabel = _ref.passwordLabel,
202
367
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
203
368
  submitButtonLabel = _ref.submitButtonLabel,
204
- props = _objectWithoutProperties(_ref, _excluded);
369
+ props = _objectWithoutProperties(_ref, _excluded$1);
205
370
 
206
371
  return /*#__PURE__*/React.createElement(Form, Object.assign({
207
372
  action: action,
@@ -220,7 +385,71 @@ var ResetPassword = function ResetPassword(_ref) {
220
385
  }, props));
221
386
  };
222
387
 
223
- ResetPassword.propTypes = propTypes;
224
- ResetPassword.defaultProps = defaultProps;
388
+ ResetPassword.propTypes = propTypes$1;
389
+ ResetPassword.defaultProps = defaultProps$1;
390
+
391
+ var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
392
+ var propTypes = {
393
+ action: PropTypes.string,
394
+ fields: PropTypes$1.fields,
395
+ size: PropTypes.string,
396
+ explainationLabel: PropTypes$1.label,
397
+ submitButtonLabel: PropTypes$1.label,
398
+ withSkipLink: PropTypes.bool,
399
+ skipLink: PropTypes.string,
400
+ skipLabel: PropTypes$1.label
401
+ };
402
+ var defaultProps = {
403
+ action: '/user/two-factor-authentication',
404
+ fields: null,
405
+ size: 'lg',
406
+ explainationLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
407
+ id: "zTiC4D",
408
+ defaultMessage: [{
409
+ "type": 0,
410
+ "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."
411
+ }]
412
+ }),
413
+ submitButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
414
+ id: "gj67c0",
415
+ defaultMessage: [{
416
+ "type": 0,
417
+ "value": "Enable Two Factor authentication"
418
+ }]
419
+ }),
420
+ withSkipLink: true,
421
+ skipLink: '/home',
422
+ skipLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
423
+ id: "li2Qqu",
424
+ defaultMessage: [{
425
+ "type": 0,
426
+ "value": "Skip setup"
427
+ }]
428
+ })
429
+ };
430
+
431
+ var TwoFactor = function TwoFactor(_ref) {
432
+ var action = _ref.action;
433
+ _ref.fields;
434
+ var explainationLabel = _ref.explainationLabel,
435
+ submitButtonLabel = _ref.submitButtonLabel;
436
+ _ref.size;
437
+ var withSkipLink = _ref.withSkipLink,
438
+ skipLink = _ref.skipLink,
439
+ skipLabel = _ref.skipLabel,
440
+ props = _objectWithoutProperties(_ref, _excluded);
441
+
442
+ return /*#__PURE__*/React.createElement(Form, Object.assign({
443
+ action: action,
444
+ submitButtonLabel: submitButtonLabel,
445
+ actions: withSkipLink ? /*#__PURE__*/React.createElement(Link, {
446
+ className: "py-2 px-4",
447
+ to: skipLink
448
+ }, skipLabel) : null
449
+ }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel));
450
+ };
451
+
452
+ TwoFactor.propTypes = propTypes;
453
+ TwoFactor.defaultProps = defaultProps;
225
454
 
226
- export { ForgotPassword, LoginForm as Login, ResetPassword };
455
+ export { ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactor };
package/lib/index.js CHANGED
@@ -17,9 +17,60 @@ var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
17
17
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
18
18
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
19
 
20
- var _excluded$2 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
21
- var propTypes$2 = {
22
- action: PropTypes__default["default"].string.isRequired,
20
+ var _excluded$5 = ["action", "fields", "size", "passwordLabel", "submitButtonLabel"];
21
+ var propTypes$5 = {
22
+ action: PropTypes__default["default"].string,
23
+ fields: core.PropTypes.fields,
24
+ size: PropTypes__default["default"].string,
25
+ passwordLabel: core.PropTypes.label,
26
+ submitButtonLabel: core.PropTypes.label
27
+ };
28
+ var defaultProps$5 = {
29
+ action: '/user/confirm-password',
30
+ fields: null,
31
+ size: 'lg',
32
+ passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
33
+ id: "B1h3gd",
34
+ defaultMessage: [{
35
+ "type": 0,
36
+ "value": "Please enter your password to continue"
37
+ }]
38
+ }),
39
+ submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
40
+ id: "RRwdkV",
41
+ defaultMessage: [{
42
+ "type": 0,
43
+ "value": "Contnue"
44
+ }]
45
+ })
46
+ };
47
+
48
+ var ConfirmPassword = function ConfirmPassword(_ref) {
49
+ var action = _ref.action,
50
+ fields = _ref.fields,
51
+ size = _ref.size,
52
+ passwordLabel = _ref.passwordLabel,
53
+ submitButtonLabel = _ref.submitButtonLabel,
54
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$5);
55
+
56
+ return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
57
+ action: action,
58
+ fields: fields || [{
59
+ name: 'password',
60
+ type: 'password',
61
+ size: size,
62
+ label: passwordLabel
63
+ }],
64
+ submitButtonLabel: submitButtonLabel
65
+ }, props));
66
+ };
67
+
68
+ ConfirmPassword.propTypes = propTypes$5;
69
+ ConfirmPassword.defaultProps = defaultProps$5;
70
+
71
+ var _excluded$4 = ["action", "fields", "emailLabel", "submitButtonLabel", "size", "withLoginLink", "loginLink", "loginLabel"];
72
+ var propTypes$4 = {
73
+ action: PropTypes__default["default"].string,
23
74
  fields: core.PropTypes.fields,
24
75
  size: PropTypes__default["default"].string,
25
76
  emailLabel: core.PropTypes.label,
@@ -28,7 +79,8 @@ var propTypes$2 = {
28
79
  loginLink: PropTypes__default["default"].string,
29
80
  loginLabel: core.PropTypes.label
30
81
  };
31
- var defaultProps$2 = {
82
+ var defaultProps$4 = {
83
+ action: '/forgot-password',
32
84
  fields: null,
33
85
  size: 'lg',
34
86
  emailLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
@@ -48,7 +100,7 @@ var defaultProps$2 = {
48
100
  withLoginLink: true,
49
101
  loginLink: '/login',
50
102
  loginLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
51
- id: "X4fQOn",
103
+ id: "tPeIKO",
52
104
  defaultMessage: [{
53
105
  "type": 0,
54
106
  "value": "Go back to login"
@@ -65,7 +117,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
65
117
  withLoginLink = _ref.withLoginLink,
66
118
  loginLink = _ref.loginLink,
67
119
  loginLabel = _ref.loginLabel,
68
- props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
120
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$4);
69
121
 
70
122
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
71
123
  action: action,
@@ -77,17 +129,17 @@ var ForgotPassword = function ForgotPassword(_ref) {
77
129
  }],
78
130
  submitButtonLabel: submitButtonLabel,
79
131
  actions: withLoginLink ? /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
80
- className: "py-2 px-5",
132
+ className: "py-2 px-4",
81
133
  to: loginLink
82
134
  }, loginLabel) : null
83
135
  }, props));
84
136
  };
85
137
 
86
- ForgotPassword.propTypes = propTypes$2;
87
- ForgotPassword.defaultProps = defaultProps$2;
138
+ ForgotPassword.propTypes = propTypes$4;
139
+ ForgotPassword.defaultProps = defaultProps$4;
88
140
 
89
- var _excluded$1 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
90
- var propTypes$1 = {
141
+ var _excluded$3 = ["action", "fields", "size", "emailLabel", "passwordLabel", "submitButtonLabel", "withForgotPassword", "forgotPasswordLink", "forgotPasswordLabel"];
142
+ var propTypes$3 = {
91
143
  action: PropTypes__default["default"].string,
92
144
  fields: core.PropTypes.fields,
93
145
  size: PropTypes__default["default"].string,
@@ -98,7 +150,7 @@ var propTypes$1 = {
98
150
  forgotPasswordLink: PropTypes__default["default"].string,
99
151
  forgotPasswordLabel: core.PropTypes.label
100
152
  };
101
- var defaultProps$1 = {
153
+ var defaultProps$3 = {
102
154
  action: '/login',
103
155
  fields: null,
104
156
  size: 'lg',
@@ -126,7 +178,7 @@ var defaultProps$1 = {
126
178
  withForgotPassword: true,
127
179
  forgotPasswordLink: '/forgot-password',
128
180
  forgotPasswordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
129
- id: "oKZDBl",
181
+ id: "ZBNqY2",
130
182
  defaultMessage: [{
131
183
  "type": 0,
132
184
  "value": "Forgot your password?"
@@ -134,7 +186,7 @@ var defaultProps$1 = {
134
186
  })
135
187
  };
136
188
 
137
- var LoginForm = function LoginForm(_ref) {
189
+ var Login = function Login(_ref) {
138
190
  var action = _ref.action,
139
191
  fields = _ref.fields,
140
192
  size = _ref.size,
@@ -144,7 +196,7 @@ var LoginForm = function LoginForm(_ref) {
144
196
  withForgotPassword = _ref.withForgotPassword,
145
197
  forgotPasswordLink = _ref.forgotPasswordLink,
146
198
  forgotPasswordLabel = _ref.forgotPasswordLabel,
147
- props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
199
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$3);
148
200
 
149
201
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
150
202
  action: action,
@@ -161,25 +213,138 @@ var LoginForm = function LoginForm(_ref) {
161
213
  }],
162
214
  submitButtonLabel: submitButtonLabel,
163
215
  actions: withForgotPassword ? /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
164
- className: "py-2 px-5",
216
+ className: "py-2 px-4",
165
217
  to: forgotPasswordLink
166
218
  }, forgotPasswordLabel) : null
167
219
  }, props));
168
220
  };
169
221
 
170
- LoginForm.propTypes = propTypes$1;
171
- LoginForm.defaultProps = defaultProps$1;
222
+ Login.propTypes = propTypes$3;
223
+ Login.defaultProps = defaultProps$3;
172
224
 
173
- var _excluded = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
174
- var propTypes = {
175
- action: PropTypes__default["default"].string.isRequired,
225
+ var _excluded$2 = ["action", "fields", "size", "nameLabel", "emailLabel", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel", "withLoginLink", "loginLink", "loginLabel"];
226
+ var propTypes$2 = {
227
+ action: PropTypes__default["default"].string,
228
+ fields: core.PropTypes.fields,
229
+ size: PropTypes__default["default"].string,
230
+ nameLabel: core.PropTypes.label,
231
+ emailLabel: core.PropTypes.label,
232
+ passwordLabel: core.PropTypes.label,
233
+ passwordConfirmationLabel: core.PropTypes.label,
234
+ submitButtonLabel: core.PropTypes.label,
235
+ withLoginLink: PropTypes__default["default"].bool,
236
+ loginLink: PropTypes__default["default"].string,
237
+ loginLabel: core.PropTypes.label
238
+ };
239
+ var defaultProps$2 = {
240
+ action: '/register',
241
+ fields: null,
242
+ size: 'lg',
243
+ nameLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
244
+ id: "UUv8FR",
245
+ defaultMessage: [{
246
+ "type": 0,
247
+ "value": "Name"
248
+ }]
249
+ }),
250
+ emailLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
251
+ id: "LI0Gz4",
252
+ defaultMessage: [{
253
+ "type": 0,
254
+ "value": "Email"
255
+ }]
256
+ }),
257
+ passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
258
+ id: "4yfet+",
259
+ defaultMessage: [{
260
+ "type": 0,
261
+ "value": "Password"
262
+ }]
263
+ }),
264
+ passwordConfirmationLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
265
+ id: "VhJUeW",
266
+ defaultMessage: [{
267
+ "type": 0,
268
+ "value": "Confirm your password"
269
+ }]
270
+ }),
271
+ submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
272
+ id: "PQX/ph",
273
+ defaultMessage: [{
274
+ "type": 0,
275
+ "value": "Create account"
276
+ }]
277
+ }),
278
+ withLoginLink: true,
279
+ loginLink: '/forgot-password',
280
+ loginLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
281
+ id: "wa783M",
282
+ defaultMessage: [{
283
+ "type": 0,
284
+ "value": "Already have an account? Go to login"
285
+ }]
286
+ })
287
+ };
288
+
289
+ var Register = function Register(_ref) {
290
+ var action = _ref.action,
291
+ fields = _ref.fields,
292
+ size = _ref.size,
293
+ nameLabel = _ref.nameLabel,
294
+ emailLabel = _ref.emailLabel,
295
+ passwordLabel = _ref.passwordLabel,
296
+ passwordConfirmationLabel = _ref.passwordConfirmationLabel,
297
+ submitButtonLabel = _ref.submitButtonLabel,
298
+ withLoginLink = _ref.withLoginLink,
299
+ loginLink = _ref.loginLink,
300
+ loginLabel = _ref.loginLabel,
301
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
302
+
303
+ return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
304
+ action: action,
305
+ fields: fields || [{
306
+ name: 'name',
307
+ type: 'text',
308
+ size: size,
309
+ label: nameLabel
310
+ }, {
311
+ name: 'email',
312
+ type: 'email',
313
+ size: size,
314
+ label: emailLabel
315
+ }, {
316
+ name: 'password',
317
+ type: 'password',
318
+ size: size,
319
+ label: passwordLabel
320
+ }, {
321
+ name: 'password_confirmation',
322
+ type: 'password',
323
+ size: size,
324
+ label: passwordConfirmationLabel
325
+ }],
326
+ submitButtonLabel: submitButtonLabel,
327
+ actions: withLoginLink ? /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
328
+ className: "py-2 px-4",
329
+ to: loginLink
330
+ }, loginLabel) : null
331
+ }, props));
332
+ };
333
+
334
+ Register.propTypes = propTypes$2;
335
+ Register.defaultProps = defaultProps$2;
336
+
337
+ var _excluded$1 = ["action", "fields", "size", "passwordLabel", "passwordConfirmationLabel", "submitButtonLabel"];
338
+ var propTypes$1 = {
339
+ action: PropTypes__default["default"].string,
176
340
  fields: core.PropTypes.fields,
177
341
  size: PropTypes__default["default"].string,
178
342
  passwordLabel: core.PropTypes.label,
179
343
  passwordConfirmationLabel: core.PropTypes.label,
180
344
  submitButtonLabel: core.PropTypes.label
181
345
  };
182
- var defaultProps = {
346
+ var defaultProps$1 = {
347
+ action: '/reset-password',
183
348
  fields: null,
184
349
  size: 'lg',
185
350
  passwordLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
@@ -190,10 +355,10 @@ var defaultProps = {
190
355
  }]
191
356
  }),
192
357
  passwordConfirmationLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
193
- id: "SdtI90",
358
+ id: "VhJUeW",
194
359
  defaultMessage: [{
195
360
  "type": 0,
196
- "value": "Password confirmation"
361
+ "value": "Confirm your password"
197
362
  }]
198
363
  }),
199
364
  submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
@@ -212,7 +377,7 @@ var ResetPassword = function ResetPassword(_ref) {
212
377
  passwordLabel = _ref.passwordLabel,
213
378
  passwordConfirmationLabel = _ref.passwordConfirmationLabel,
214
379
  submitButtonLabel = _ref.submitButtonLabel,
215
- props = _objectWithoutProperties__default["default"](_ref, _excluded);
380
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
216
381
 
217
382
  return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
218
383
  action: action,
@@ -231,9 +396,76 @@ var ResetPassword = function ResetPassword(_ref) {
231
396
  }, props));
232
397
  };
233
398
 
234
- ResetPassword.propTypes = propTypes;
235
- ResetPassword.defaultProps = defaultProps;
399
+ ResetPassword.propTypes = propTypes$1;
400
+ ResetPassword.defaultProps = defaultProps$1;
401
+
402
+ var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
403
+ var propTypes = {
404
+ action: PropTypes__default["default"].string,
405
+ fields: core.PropTypes.fields,
406
+ size: PropTypes__default["default"].string,
407
+ explainationLabel: core.PropTypes.label,
408
+ submitButtonLabel: core.PropTypes.label,
409
+ withSkipLink: PropTypes__default["default"].bool,
410
+ skipLink: PropTypes__default["default"].string,
411
+ skipLabel: core.PropTypes.label
412
+ };
413
+ var defaultProps = {
414
+ action: '/user/two-factor-authentication',
415
+ fields: null,
416
+ size: 'lg',
417
+ explainationLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
418
+ id: "zTiC4D",
419
+ defaultMessage: [{
420
+ "type": 0,
421
+ "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."
422
+ }]
423
+ }),
424
+ submitButtonLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
425
+ id: "gj67c0",
426
+ defaultMessage: [{
427
+ "type": 0,
428
+ "value": "Enable Two Factor authentication"
429
+ }]
430
+ }),
431
+ withSkipLink: true,
432
+ skipLink: '/home',
433
+ skipLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
434
+ id: "li2Qqu",
435
+ defaultMessage: [{
436
+ "type": 0,
437
+ "value": "Skip setup"
438
+ }]
439
+ })
440
+ };
441
+
442
+ var TwoFactor = function TwoFactor(_ref) {
443
+ var action = _ref.action;
444
+ _ref.fields;
445
+ var explainationLabel = _ref.explainationLabel,
446
+ submitButtonLabel = _ref.submitButtonLabel;
447
+ _ref.size;
448
+ var withSkipLink = _ref.withSkipLink,
449
+ skipLink = _ref.skipLink,
450
+ skipLabel = _ref.skipLabel,
451
+ props = _objectWithoutProperties__default["default"](_ref, _excluded);
452
+
453
+ return /*#__PURE__*/React__default["default"].createElement(Form__default["default"], Object.assign({
454
+ action: action,
455
+ submitButtonLabel: submitButtonLabel,
456
+ actions: withSkipLink ? /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
457
+ className: "py-2 px-4",
458
+ to: skipLink
459
+ }, skipLabel) : null
460
+ }, props), /*#__PURE__*/React__default["default"].createElement("p", null, explainationLabel));
461
+ };
462
+
463
+ TwoFactor.propTypes = propTypes;
464
+ TwoFactor.defaultProps = defaultProps;
236
465
 
466
+ exports.ConfirmPassword = ConfirmPassword;
237
467
  exports.ForgotPassword = ForgotPassword;
238
- exports.Login = LoginForm;
468
+ exports.Login = Login;
469
+ exports.Register = Register;
239
470
  exports.ResetPassword = ResetPassword;
471
+ exports.TwoFactor = TwoFactor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/form-auth",
3
- "version": "1.0.0-alpha.238",
3
+ "version": "1.0.0-alpha.242",
4
4
  "description": "Basic forgot password form",
5
5
  "keywords": [
6
6
  "javascript"
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.12.5",
49
- "@panneau/core": "^1.0.0-alpha.237",
50
- "@panneau/form": "^1.0.0-alpha.238",
49
+ "@panneau/core": "^1.0.0-alpha.242",
50
+ "@panneau/form": "^1.0.0-alpha.242",
51
51
  "classnames": "^2.2.6",
52
52
  "lodash": "^4.17.21",
53
53
  "prop-types": "^15.7.2",
@@ -57,5 +57,5 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "5880be043483f24d405a1805b70019c25b96573d"
60
+ "gitHead": "642186399b25e090f6fa3a210d14f195e2121a38"
61
61
  }