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

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